Eval Problem

Victor Subervi victorsubervi at gmail.com
Mon Apr 6 21:11:35 CEST 2009


Hi:
I have this code:

x = 1
while x <= bitties:
  file = open(p + str(x) + ".txt")
  for line in file:
    print line
  print eval(bits[x - 1])
  x += 1

which throws this error:

[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: Traceback (most recent call last):
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: File
"/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 299, in
HandlerDispatch\n result = object(req)
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: File
"/usr/lib64/python2.4/site-packages/mod_python/cgihandler.py", line 96, in
handler\n imp.load_module(module_name, fd, path, desc)
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: File "/var/www/vhosts/
articles.13gems.com/httpdocs/index_frame.py", line 89, in ?\n print
eval(bits[1])
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: File "<string>", line 1
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: tableBottom(348,180)
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: ^
[Mon Apr 06 12:07:29 2009] [error] [client 190.166.0.221] PythonHandler
mod_python.cgihandler: SyntaxError: invalid syntax

However, if I edit out the offending line and add:

print tableBottom(348,180)

it prints! What´s wrong?
TIA,
Victor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090406/a6b1924f/attachment.html>


More information about the Python-list mailing list