Hi,

may anybody tell me what "initializes the interpreter" mean in detail? Does this function starts a new process or thread of the python interpreter in the background or what does this call do?? Hopefully somebody can give me a little hint :)

Jonny

Recommended Answers

All 2 Replies

It isn't PyInitialize, it is Py_Initialize, searching for it on docs.python.org will return a few results, such as the ones below. I have also included a bit of explanation regarding this particular function, which comes directly from the documentation.

Python/C API Reference Manual - Embedding Python
Extending and Embedding the Python Interpreter

"The one important task that only embedders (as opposed to extension writers) of the Python interpreter have to worry about is the initialization, and possibly the finalization, of the Python interpreter. Most functionality of the interpreter can only be used after the interpreter has been initialized.

The basic initialization function is Py_Initialize(). This initializes the table of loaded modules, and creates the fundamental modules __builtin__, __main__, sys, and exceptions. It also initializes the module search path (sys.path)."

Okay thank's. I read both manuals but the main think is how I have to fancy that interpreter thing. Does the Py_Initialize() start an interpreter like starting a new process or a new thread within (in terms of thread) my application. Let me say something like an interpreter without user interface.
Or do I initialize some global variables and then use the same function-calls a interpreter (python.exe) would use?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.