Printing returned object in embedded app

Conrad Steenberg conrad at srl.caltech.edu
Fri Jul 9 20:34:04 EDT 1999


Hi

I'm trying to construct an interactive front-end for Python, using GTK.

My C program passes strings to PyRun_String, and obtains the returned object.
Now in the normal interactive Python on a terminal, a command like
1+1
would print out the value, but using my method it does not. Using
print(1+1) works like a charm. However, when I try to have the returned object
printed using eg. 
PyObject_CallMethod(object,"print","") 
I get an error, "AttributeError: print". Can anybody tell me what I'm doing
wrong? Or how to get the result printed automatically like in interactive
Python?

Thanks!

Conrad
--




More information about the Python-list mailing list