[Zope] chr(eval(self.myhex)) works in Python console, not in python product?

Dieter Maurer dieter@handshake.de
Thu, 19 Dec 2002 19:47:09 +0100


Jeff Kowalczyk writes:
 > If the following works:
 > >>> class Foo:
 > ...  def __init__(self):
 > ...   self.myhex = '0x2a'
 > ...  def bar(self):
 > ...   print chr(eval(self.myhex))
 > ...
 > >>> foo = Foo()
 > >>> foo.bar()
 > *
 > in Zope's python console (2.1.3),
 > 
 > But in a Zope Python product method the same sort of thing fails:
 > 
 > Error Type: SyntaxError
 > Error Value: unexpected EOF while parsing (line 0)
A long time ago, I saw a similar problem report in "c.l.p".
Guido recommended to add 1 or 2 newlines after the string.


Dieter