> Is the `code` module (http://docs.python.org/library/code.html) an > insufficiently exact copy of an interpreter for you? The problem isn't really to emulate the behavior of the interpreter as to obtain the result of the execution as a string in c++. The code module doesn't seem to help with this matter. > I assume you could simply use PyFile_FromFd? According to the documentation using PyFile_FromFd seems unadvised, but I'll give it a try. > The more elegant solution might be to create custom Python file-like> objects > for std{in,out,err} that communicate directly with your application.I thought > about this, but I need the console window to be non-modal and I'm afraid that > replacing stdin witha custom file-like object would cause a blocking call. > Executing python in a second thread would solve this problembut our > application isn't multi-threaded and executing python in another thread > causes errors. Maybe I could use a file-like object to communicate the results to my c++ application and use the code module to execute code only when the c++ application needs it. Thanks a lot for the tips, have a nice day. F.L.
-- http://mail.python.org/mailman/listinfo/python-list