28 messages in ru.sysoev.nginx[wsgi] Python interpreter initialization
FromSent OnAttachments
Manlio PerilloAug 20, 2007 3:15 am 
Igor SysoevAug 20, 2007 3:28 am 
Igor SysoevAug 20, 2007 3:41 am 
Igor SysoevAug 20, 2007 3:45 am 
Manlio PerilloAug 20, 2007 3:50 am 
Manlio PerilloAug 20, 2007 3:57 am 
Igor SysoevAug 20, 2007 6:17 am 
Manlio PerilloAug 20, 2007 6:35 am 
Manlio PerilloAug 20, 2007 1:16 pm 
Rui LopesAug 20, 2007 1:35 pm 
Aleksandar LazicAug 20, 2007 1:52 pm 
Manlio PerilloAug 20, 2007 1:55 pm 
Cliff WellsAug 20, 2007 4:22 pm 
Manlio PerilloAug 21, 2007 12:17 am 
Manlio PerilloAug 21, 2007 12:19 am 
Aleksandar LazicAug 21, 2007 12:56 am 
Aleksandar LazicAug 21, 2007 12:58 am 
Aleksandar LazicAug 21, 2007 1:00 am 
Manlio PerilloAug 21, 2007 1:04 am 
Manlio PerilloAug 21, 2007 4:51 am 
Aleksandar LazicAug 21, 2007 6:26 am 
marc...@public.gmane.orgAug 21, 2007 6:26 am 
Aleksandar LazicAug 21, 2007 6:34 am 
Manlio PerilloAug 21, 2007 6:35 am 
Kiril AngovAug 21, 2007 6:59 am 
Manlio PerilloAug 21, 2007 7:09 am 
Aleksandar LazicAug 21, 2007 7:17 am 
Cliff WellsAug 21, 2007 11:01 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[wsgi] Python interpreter initializationActions...
From:Manlio Perillo (manl@public.gmane.org)
Date:Aug 20, 2007 3:15:03 am
List:ru.sysoev.nginx

Hi.

I need some help for the development of mod_wsgi.

Before using the Python C API for embedding Python code, the main interpreter must be initialized by calling Py_Initialize();

This function set a global context.

In the first version of the code, I'm initializing the interpreter in the init main configuration callback (and only here).

It is possible to customize the Python interpreter by setting some options before calling Py_Initialize. These options are available as nginx commands in the main context only.

In the request handler I have added a call to the function Py_IsInitialized(), just to be sure.

I'm assuming that the main configuration is initialized in the core nginx process and that each one of the worker process simply inherit the Python interpreter context.

I'm right?

What happens on Windows (where fork is not available)? Should I call Py_Initialize in the init process callback, too (calling Py_Initialize two times is a no op).