Found the reason: exec('123') does not print out anything, while
enterrnig simply 123 at the python prompt does.
I guess that this:
extern void PythonRun(const char *sz)
{
if (*sz) {
PyRun_SimpleString(sz);
} else {
PyRun_SimpleString("import sys\n"
"print 'Python', sys.version\n");
while (PyRun_SimpleString(
"while 1:\n"
" print '>>> ',\n"
" line = sys.stdin.readline()\n"
" if not line:\n"
" break\n"
" exec(line)\n"))
{};
}
}
Should be changed to have the iteration over input lines in C
(but dunno if you can have readline functionalities as easily as in
python) and just call PyRun_SimpleString on each line.
Would also have to detect the ^Z to quit python mode ...
MaX.
2009/9/3 Christian Anthon <[email protected]>:
> For reasons unknown it is not easy to start an interactive python
> session from within a python script so I cooked something quick that
> would at least partly emulate a session. Not too important I should
> think, but if it turns out that it works reliably with the official
> python we could improve on the session code.
_______________________________________________
Bug-gnubg mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnubg