On Sunday, December 21, 2014 2:44:50 AM UTC-5, CM wrote: > On Sunday, December 21, 2014 1:45:02 AM UTC-5, Chris Angelico wrote: > > On Sun, Dec 21, 2014 at 5:31 PM, Terry Reedy 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: > > > > >>> os.fdopen(1,"w").write("Hello, world\n") > > Traceback (most recent call last): > > File "<pyshell#4>", line 1, in <module> > > os.fdopen(1,"w").write("Hello, world\n") > > OSError: [Errno 9] Bad file descriptor > > > > This works fine in command-line Python, just not in IDLE. It's not > > Windows vs Unix, it's Idle vs terminal. > > > > ChrisA > > Yes, just tested it on the same machine in the terminal and it prints: > > Hello, world! > 13
Actually, there is no comma after Hello. -- https://mail.python.org/mailman/listinfo/python-list