Re: Extending embedded python-can extensions be local to a dictionary?

2009-08-12 Thread Carl Banks
On Aug 12, 12:44 pm, Michael Kohout wrote: > Hello all- > > I've got a multithreaded server-based application that I'd like to use > python to provide plugin support for.  At execution time I would like > each call to the plugin/plugins to have their own implementation of > these extension methods

Extending embedded python-can extensions be local to a dictionary?

2009-08-12 Thread Michael Kohout
/extending/embedding.html#extending-embedded-python, I see how to add functions, but it looks like they are added at a global scope-not in a particular environment. Is there any way to add an extension to a local environment but not pollute the global env? FYI, I'm embedding python 2.6, but I'

Extending embedded python of multiple interpreters

2007-03-31 Thread vishnu
Hello All, I have embedded python 2.5 in to my C application. As we need the python scripts to run in multi threaded environment I have used Py_NewInterpreter() and Py_EndInterpreter each time I execute a run script function. The code is as follows: RunScript(char *pScriptName,char *pFuncName,...)

Re: Extending Embedded Python and execute external script

2007-01-04 Thread Fredrik Lundh
"Vertilka" <[EMAIL PROTECTED]> wrote: > I saw several functions: PyRun_AnyFileExFlags, PyRun_SimpleFileExFlags, > PyRun_FileExFlags. > > Questions: > 1) Which one should i use in order to achieve what i need ? PyRun_SimpleFile or PyRun_SimpleString should be good enough. Using SimpleString is mo

Extending Embedded Python and execute external script

2007-01-04 Thread Vertilka
What i need from my C application to do ? 1) To execute a python script from file. 2) The python script will call functions in my C application. According to the answer from Ravi Teja (topic "C app and Python"), I need to extend embedded python in my C application. I saw several functions: PyRun_

Re: Extending embedded Python: Adding single methods

2006-03-08 Thread Thomas Heller
Torsten Bronger wrote: > Hallöchen! > > Thomas Heller <[EMAIL PROTECTED]> writes: > >> Torsten Bronger wrote: >> >>> [...] However, is there a way to avoid this dummy "pp3" module >>> and add the C++ functions directy to the main namespace in the >>> Python script? >> Yes. You can import __buil

Re: Extending embedded Python: Adding single methods

2006-03-08 Thread Torsten Bronger
Hallöchen! Thomas Heller <[EMAIL PROTECTED]> writes: > Torsten Bronger wrote: > >> [...] However, is there a way to avoid this dummy "pp3" module >> and add the C++ functions directy to the main namespace in the >> Python script? > > Yes. You can import __builtin__, and add methods to it. This

Re: Extending embedded Python: Adding single methods

2006-03-08 Thread Thomas Heller
Torsten Bronger wrote: > Hallöchen! > > I'd like to script C++ funtions by an embedded Python interpreter. > So far, my C++ main() function contains: > > Py_Initialize(); > Py_InitModule("pp3", PythonMethods); > PyRun_SimpleString("from pp3 import *"); > PyRun_AnyFile(stdin, NULL); > Py

Extending embedded Python: Adding single methods

2006-03-08 Thread Torsten Bronger
Hallöchen! I'd like to script C++ funtions by an embedded Python interpreter. So far, my C++ main() function contains: Py_Initialize(); Py_InitModule("pp3", PythonMethods); PyRun_SimpleString("from pp3 import *"); PyRun_AnyFile(stdin, NULL); Py_Finalize(); "PythonMethods" is the vector

Re: Extending Embedded Python

2005-09-25 Thread Fredrik Lundh
Richard Townsend wrote: > In the "Extending and Embedding" part of the Python documentation: section > 5.4 "Extending Embedded Python" - it describes how to use a Python > extension module from Python that is embedded in a C application. > > Is it safe to cal

Extending Embedded Python

2005-09-24 Thread Richard Townsend
In the "Extending and Embedding" part of the Python documentation: section 5.4 "Extending Embedded Python" - it describes how to use a Python extension module from Python that is embedded in a C application. Is it safe to call Py_InitModule() more than once in the same appli