Using PyRun_SimpleString for blocks of Python Code

btheld2 at my-deja.com btheld2 at my-deja.com
Tue Feb 6 13:49:55 EST 2001


I am embedded Python in a C++ application and I need to send it blocks
of code.  For example:

if 1:
     print "Hi"

How do I do this using PyRun_SimpleString?  For this simple case, I
think I can send it "if 1: print "Hi"", but for more complex loops:

if 1:
     print "Hi"
     if 2:
           print "Bye"
           print "Bye"
     print "Hi2"
print "Done"

What do I do?


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list