Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #35371

Re: redirect standard output problem

References <cf470745-6ee6-464c-b936-154a869af997@googlegroups.com> <mailman.1141.1356074653.29569.python-list@python.org> <0d7c7686-8b06-4dc2-8b57-3f22d1ef93ae@googlegroups.com>
Date 2012-12-23 02:15 +1100
Subject Re: redirect standard output problem
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1203.1356189305.29569.python-list@python.org> (permalink)

Show all headers | View raw


On Sun, Dec 23, 2012 at 2:07 AM, iMath <redstone-cold@163.com> wrote:
> when I run it through command line ,it works ok ,but when I run it through IDLE , only print A but leave out 888
> so why ?

Because IDLE has to fiddle with stdin/stdout a bit to function. Try
adopting Dave's recommendation - you'll likely find that it then
works.

Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600
32 bit (Intel)] on win32
>>> sys.stdout is sys.__stdout__
True

The same in IDLE:
>>> sys.stdout is sys.__stdout__
False

Whenever you work in IDLE, expect that some things will be slightly
different, mostly to do with standard I/O streams. So when you post
issues that you've come across, please state that you're using IDLE -
it likely makes a difference!

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

redirect standard output problem iMath <redstone-cold@163.com> - 2012-12-20 21:23 -0800
  Re: redirect standard output problem Chris Angelico <rosuav@gmail.com> - 2012-12-21 18:24 +1100
    Re: redirect standard output problem iMath <redstone-cold@163.com> - 2012-12-22 07:07 -0800
      Re: redirect standard output problem Chris Angelico <rosuav@gmail.com> - 2012-12-23 02:15 +1100
      Re: redirect standard output problem Terry Reedy <tjreedy@udel.edu> - 2012-12-22 16:02 -0500
    Re: redirect standard output problem iMath <redstone-cold@163.com> - 2012-12-22 07:07 -0800
  Re: redirect standard output problem Hans Mulder <hansmu@xs4all.nl> - 2012-12-21 14:42 +0100
  Re: redirect standard output problem Dave Angel <d@davea.name> - 2012-12-21 09:36 -0500

csiph-web