embedding interactive python interpreter
eryksun ()
eryksun at gmail.com
Sun Mar 27 23:47:34 EDT 2011
On Sunday, March 27, 2011 11:06:47 PM UTC-4, Eric Frederich wrote:
> I'm not sure that I know how to run this function in such a way that
> it gives me an interactive session.
> I passed in stdin as the first parameter and NULL as the second and
> I'd get seg faults when running exit() or even imnport sys.
Passing NULL as the 2nd parameter causes the segfault. Do this instead:
FILE* fp = stdin;
char *filename = "Embedded";
PyRun_InteractiveLoop(fp, filename);
See here regarding the segfault:
http://bugs.python.org/issue5121
More information about the Python-list
mailing list