Hello World

Devin Jeanpierre jeanpierreda at gmail.com
Sat Jan 17 19:06:06 EST 2015


Sorry for necro.

On Sat, Dec 20, 2014 at 10:44 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Sun, Dec 21, 2014 at 5:31 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> Just to be clear, writing to sys.stdout works fine in Idle.
>>>>> import sys; sys.stdout.write('hello ')
>> hello  #2.7
>>
>> In 3.4, the number of chars? bytes? is returned and written also.
>>
>> Whether you mean something different by 'stdout' or not, I am not sure.  The
>> error is from writing to a non-existent file descriptor.
>
> That's because sys.stdout is replaced. But stdout itself, file
> descriptor 1, is not available:

It surprises me that IDLE, and most other shells, don't dup2
stdout/err/in so that those FDs talk to IDLE.

-- Devin



More information about the Python-list mailing list