rexec question

Ralf Doering ralf.doering at prakinf.tu-ilmenau.de
Thu Aug 5 08:50:12 CEST 1999


Hello again,
it seems that I did not really understand how to work with the rexec
module. 
The problem is that I do not know how to access an object defined in
the *calling* namespace inside the r_exec/r_eval call like in the
following example:

import rexec

class foo:
    def start(self):
        print "foo running"


def rexectest():
    o = foo()
    filter = rexec.RExec()
    filter.r_exec("o.start()")

>>> rexectest()
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "rexecquestion.py", line 11, in rexectest
    filter.r_exec("o.start()")
  File "/wrk2/tele2/doering/gnu/lib/python1.5/rexec.py", line 253, in r_exec
    exec code in m.__dict__
  File "<string>", line 1, in ?
NameError: o


Any hints for a newbie?

Ralf
-- 
No sig -- no fun




More information about the Python-list mailing list