Scope of InteractiveInterpreter?

Kris Caselden google at hanger.snowbird.net
Thu Aug 21 03:39:27 EDT 2003


I'm using the InteractiveInterpreter to run some source, but the data
generated doesn't seem to be available in the scope of the parent.

For instance, I tried

lines = infile.open('data.py','r').readlines()
ii = InteractiveInterpreter({'__name__': '__main__', '__doc__': None})
for line in lines:
    ii.runsource(line)

but the data objects in data.py don't seem to exist when I try and
manipulate them later in the script. Is what I'm trying to do
possible? Am I on the right track?




More information about the Python-list mailing list