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

Re: PyRun_String with Py_single_input to stdout?

2007-06-18 Thread [EMAIL PROTECTED]
I found a solution using sys.displayhook here: http://groups.google.com/group/comp.lang.python/browse_thread/thread/593cd28e568c32e1/1e0f930e7ac5ebb2?#1e0f930e7ac5ebb2 On Jun 18, 4:24 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 18 Jun 2007 01:45:38 -0300, [EMAIL PROTECTED] > <[EMA

Re: PyRun_String with Py_single_input to stdout?

2007-06-18 Thread Gabriel Genellina
En Mon, 18 Jun 2007 01:45:38 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I'm using PyRun_String with Py_single_input for a python interpreter > embedded in my application. I'm using Py_single_input. Py_single input > is what I want, but it seems to output to stdout. Before when I wa

Re: PyRun_String and related functions causing garbage when calling a parsed function from C.

2007-05-13 Thread Gabriel Genellina
En Sun, 13 May 2007 17:58:17 -0300, <[EMAIL PROTECTED]> escribió: > Hi I'm getting extremely odd behavior. First of all, why isn't > PyEval_EvalCode documented anywhere? Anyway, I'm working on > blender's > python integration (it embeds python, as opposed to python embedding > it). I have a fu

Re: PyRun_String

2006-03-09 Thread Matthias
Am Thu, 09 Mar 2006 20:06:54 +0100 hat Duncan Booth <[EMAIL PROTECTED]> geschrieben: > Matthias wrote: > >> Log("Marker 1"); >> Py_XDECREF( PyRun_String( "print 'Hi!'", Py_single_input, Dict, Dict) ); >> Log("Marker 2"); >> >> The output looks like >> >> Marker 1 >> Hi! >> Hi! >> Marker 2 >> >>

Re: PyRun_String

2006-03-09 Thread Duncan Booth
Matthias wrote: > Log("Marker 1"); > Py_XDECREF( PyRun_String( "print 'Hi!'", Py_single_input, Dict, Dict) ); > Log("Marker 2"); > > The output looks like > > Marker 1 > Hi! > Hi! > Marker 2 > > Obviously Hi! is printed twice. Py_XDECREF is a C macro. If you check its definition you will see