problem with exec

...:::JA:::... vedrandekovic at v-programs.com
Sat Jul 21 15:25:05 EDT 2007


Hello,

After my program read and translate this code:

koristi os,sys;
ispisi 'bok kaj ima';

into the:

import os,sys;
print 'bok kaj ima';

and when it run this code with "exec", I always get error like this, but I
still dont't know what is a problem:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\VL\__init__.py", line 188, in 
kompajlati
    kompajlati_proces()
  File "C:\Python24\Lib\site-packages\VL\__init__.py", line 183, in 
kompajlati_proces
    h2=Konzola()
  File "C:\Python24\Lib\site-packages\VL\__init__.py", line 158, in __init__
    k=kod(ZTextCtrl.GetLabel())
  File "C:\Python24\Lib\site-packages\VL\__init__.py", line 83, in kod
    exec(str_ngh)
  File "<string>", line 1
    import os ,sys ;
                    ^
SyntaxError: invalid syntax

PS: How can I change when user write script with my program to he don't need
      aspirate the lines of his source code
e.g.
     import os,sys
     n=90
     if n==90:print "OK"
     else:print "No"

                                                                             
                  Regards,
                                                                             
                  Vedran


__________________________________________________________________ Vedran
veki ICQ#: 264412055 Current ICQ status: + More ways to contact me Get ICQ!
__________________________________________________________________







More information about the Python-list mailing list