Eval Problem

J. Cliff Dyer jcd at sdf.lonestar.org
Tue Apr 7 09:49:17 EDT 2009


OK.

You still haven't shown the code where tableTop gets defined, so your
code is unrunnable.  However, I think your problem is that wherever
tableTop lives, it isn't part of your globals or locals in eval.  See
the documentation on evals here:

http://www.python.org/doc/1.4/lib/node26.html

Something like the following might work:

print eval(line, {'tableTop': tableTop})

Cheers,
Cliff

On Tue, 2009-04-07 at 08:38 -0400, Victor Subervi wrote:
> 
> I have excluded the code where I call the separate text files for
> printing normal text. They work. It's my code that I cannot get to
> work. For example, if I take out the "eval" part of the above, it will
> nicely print the commands, such as this:
> 
> tableTop(123,456)
> 
> which is supposed to call said fn. If I place that line in the file
> calling the text files and the bits file it will execute just fine,
> but that inevitably makes my job harder. Ideas?
> TIA,
> Victor




More information about the Python-list mailing list