<div dir="ltr">Hi,<div><br></div><div>2015-06-30 21:40 GMT+02:00 Chris Moller <span dir="ltr"><<a href="mailto:moller@mollerware.com" target="_blank">moller@mollerware.com</a>></span>:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#CCFFFF">
I expect this has been asked before, but I can't find out much about
it...<br></div></blockquote><div><br></div><div>Please ask this kind of questions on the <a href="https://www.python.org/community/lists/">python-users mailing list</a> (or comp.lang.python).</div><div><br></div><div>There you will find helpful people who will tell you how to modify sys.stdout, and the differences between exec() and eval().</div><div><br></div><div>Best of luck using Python!</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#CCFFFF">
I'm trying to embed Python as a scripting language and I need to
capture the output of PyRun_String(), PyEval_EvalCode(), or whatever
as a char * (or wchar_t * or whatever) rather than have it go to
stdout.<br>
<br>
Python 3.3.2 under plain C, not C++<br>
<br>
And, while I'm interrupting everyone's afternoon, another question:
if I pass Py_single_input to PyRun_String() or
Py_CompileString()/PyEval_EvalCode(), it accepts statements like
"a=10" and can then properly do stuff like "print(a)". If I use
Py_eval_input instead, I get error messages. In both cases, I'm
using the same global_dict and local_dict, if that makes any
difference. What am I doing wrong?<br>
<br>
Thanks,<br>
Chris Moller<br>
</div>
<br>_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/amauryfa%40gmail.com" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/amauryfa%40gmail.com</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Amaury Forgeot d'Arc</div>
</div></div>