Weird problem ?

Mikael Aronsson mikael_aronsson at mail.bip.net
Sun Aug 8 14:22:01 EDT 1999


Hi !

I have an application with a Python interpreter embedded and when I start it
up I load a file with PyRun_SimpleFile, the file looks like this:



# Vector class

class VECTOR:
   x = 0.0
   y = 0.0
   z = 0.0
   def __init__(self,xx=0.0,yy=0.0,zz=0.0):
      self.x = xx
      self.y = yy
      self.z = zz

# Color class

class COLOR:
    r = 0.0
    g = 0.0
    b = 0.0
    a = 0.0
    def __init__(self,rr=0.0,gg=0.0,bb=0.0,aa=1.0):
       self.r = rr
       self.g = gg
       self.b = bb
       self.a = aa

xx = VECTOR()
zz = COLOR()



This loads without any error message, but when I try to compile and run this
code:


xx = COLOR()


With PyRun_SimpleString() I get the following error:

File "<string>", line 1
xx = COLOR()
           ^
SyntaxError: invalid syntax

I can call PyRun_SimpleString() with "xx = VECTOR()", this does not give any
error, I cannot fine anything wrong with my code, does anyone have any clue
to what the problem might be ?, I am running Python 1.52 on Windows NT SP4

regards,
Mikael Aronsson







More information about the Python-list mailing list