PyRun_String using my module in a def
stuart.tett at gmail.com
Thu Jul 5 06:19:32 CEST 2007
What command do you mean when you say "update main_dict with
I tried PyObject *rstring = PyRun_String( cmd, Py_file_input,
dlfl_dict, dlfl_dict );
This worked, but has the side effect of not allowing other commands
I was able to type that before, but now it just says "name 'execfile'
is not defined"
Thanks for your help! :)
On Jul 4, 10:23 pm, a... at mac.com (Alex Martelli) wrote:
> Stuart <stuart.t... at gmail.com> wrote:
> > PyObject *rstring = PyRun_String( cmd, Py_file_input, main_dict,
> > dlfl_dict );
> You're passing difl_dict as the "locals" to PyRun_String -- but a
> function has its own locals, so it won't use those locals. Just update
> main_dict with difl_dict (that's the equivalent of the "from difl import
> *" which you appear to desire) and use main_dict for both globals and
> locals in your PyRun_String call.
More information about the Python-list