>>> Don't bother. Replacing sys.stdout is the right thing to do. It
>>> won't interfere with the C++ streams...
>> I'm not so certain. Won't the C++ host app share the same
>> stdin/stdout/stderr file descriptors with the embedded Python
>> interpreter?
> No. Changing the object that the name sys
On 2010-04-16 00:42 AM, Dave W. wrote:
Think I'll start a new post with the subject: "Globally override
built-in print function?"
Don't bother. Replacing sys.stdout is the right thing to do. It
won't interfere with the C++ streams...
-snip-
I'm not so certain. Won't the C++ host app share th
> > Think I'll start a new post with the subject: "Globally override
> > built-in print function?"
> Don't bother. Replacing sys.stdout is the right thing to do. It
> won't interfere with the C++ streams...
-snip-
I'm not so certain. Won't the C++ host app share the same
stdin/stdout/stderr file
On 2010-04-15 17:54 PM, Dave W. wrote:
After your reply, I went back and
discovered that everything was actually working fine with 'global'
in place
Oops, I lied. It still doesn't work. It doesn't seem possible (or
at least not easy) to *globally* override the
> After your reply, I went back and
> discovered that everything was actually working fine with 'global'
> in place
Oops, I lied. It still doesn't work. It doesn't seem possible (or
at least not easy) to *globally* override the built-in print
function. The best
> > I thought I could get away with importing print_function
> > from __future__ ... but my re-pointed print function never gets
> > called.
> -snip-
> >def __enter__(self):
> >print = self.printhook
> That redefines the print function local to __enter__. You need to
> change the gl
On Wed, Apr 14, 2010 at 9:03 PM, Dave W. wrote:
> I thought I could get away with import print_function from __future__
> (see example code below), but my re-pointed print function never gets
> called.
-snip-
> def __enter__(self):
> print = self.printhook
That redefines the print fun
I've subclassed InteractiveInterpreter in an attempt to make it
friendlier for use in a remote console for a C++ app. What I really
wanted to do was wrap/adapt the base class's runsource() method to
return a 2-tuple (more, result) where 'more' is a bool indicating
whether a complete command was re