Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Globals, Locals Dictionaries + Callbacks Question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Faisal Alquaddoomi, post: 1855253"] Hello, I'm having a bit of trouble isolating my scripts from each other in my embedded Python interpreter, so that their global namespaces don't get all entangled. I've had some luck with PyRun_FileEx(), as you can specify dictionaries to use for the globals and locals, but it seems that you can't do the same for PyEval_CallObject() (which i use for calling the callbacks previously registered by scripts run via PyRun_FileEx()). Is there any way to substitute the current global/local dictionaries, run the callback, then switch back to the default? It would be just as good if I could switch between several sets of global variable dictionaries, one for each script; unfortunately, the documentation is less than informative on this point (there isn't even a formal defintion for PyEval_CallObject()). Also, I'm aware that eval() and exec() allow you to pass in global/local dictionaries, but I think it'd be a bit wasteful to drop into Python, run exec(), then have that call my callback, rather than just calling the callback directly from the host program. Thanks in advance [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Globals, Locals Dictionaries + Callbacks Question
Top