Re: PyRun_String using my module in a def

2007-07-05 Thread Alex Martelli
Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 05 Jul 2007 01:19:32 -0300, Stuart <[EMAIL PROTECTED]> > escribió: > > > What command do you mean when you say "update main_dict with > > dlfl_dict"? > > I think Alex Martelly was refering to use main_dict.update(dlfl_dict) > (Python code)

Re: PyRun_String using my module in a def

2007-07-05 Thread Gabriel Genellina
En Thu, 05 Jul 2007 01:19:32 -0300, Stuart <[EMAIL PROTECTED]> escribió: > What command do you mean when you say "update main_dict with > dlfl_dict"? I think Alex Martelly was refering to use main_dict.update(dlfl_dict) (Python code) or PyDict_Update(main_dict, dlfl_dict) (in C code). > I tr

Re: PyRun_String using my module in a def

2007-07-04 Thread Stuart
What command do you mean when you say "update main_dict with dlfl_dict"? 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 like "execfile" I was able to type that before, but now it just says "n

Re: PyRun_String using my module in a def

2007-07-04 Thread Alex Martelli
Stuart <[EMAIL PROTECTED]> 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

PyRun_String using my module in a def

2007-07-04 Thread Stuart
I've written my own python modules with the C API, called dlfl. I've now embedded a python interpreter into my Qt application. I am able to execute multiline/singleline blocks and it has no problems remembering definitions from one execute to the next. The problem arises when i try and use a dlfl m