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


Groups > comp.lang.python > #35371

Re: redirect standard output problem

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'win32': 0.03; 'works.': 0.07; 'python': 0.09; 'sep': 0.09; 'streams.': 0.09; 'sys.stdout': 0.09; 'dec': 0.15; 'slightly': 0.15; 'different,': 0.16; 'fiddle': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'idle,': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'mostly': 0.20; 'bit': 0.21; 'subject:problem': 0.22; 'command': 0.24; 'header:In-Reply- To:1': 0.25; 'leave': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'skip:( 20': 0.28; 'run': 0.28; 'post': 0.28; 'i/o': 0.29; 'expect': 0.31; 'print': 0.32; 'function.': 0.33; 'idle': 0.33; 'to:addr:python- list': 0.33; 'likely': 0.33; 'received:google.com': 0.34; 'false': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; "you've": 0.61; "you'll": 0.62; 'difference!': 0.84; 'adopting': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=UPFBae1Xq66rmaLwHkO0zwMt6H5ZCeBJnBW2klGWMMY=; b=0y3D0wBZMoCjrSb7htacw1ZkxVVblEx+wQ61qFTrieDf5g0PZlGOw86uYdk8sDQlXA 6M2KnIuUd8VhMY8kOYk24yipdcxvgKQMdQ9PbPrL6qZJEcs9otmzfDITIcczTfKg+3r5 UNR6OBJlD044/N7VidwNbnu8/HJoqGsrR9ysRbwGFwzCB/150hYOCsUV8D3Iqn1MyKJe bkfU1Cx2YqvEVPzZdXkiIONIMtOti2JOYRf6QlX5hyL5OLoaOoyxVHGv3vkip1a6Scjl 3xNENz1/2xx/SSUsWNpYOCezDHVZkIoh5UAsaE+uknZsU2Z8wI1hvKS2GpG21YIOOxNY HRfQ==
MIME-Version 1.0
In-Reply-To <0d7c7686-8b06-4dc2-8b57-3f22d1ef93ae@googlegroups.com>
References <cf470745-6ee6-464c-b936-154a869af997@googlegroups.com> <mailman.1141.1356074653.29569.python-list@python.org> <0d7c7686-8b06-4dc2-8b57-3f22d1ef93ae@googlegroups.com>
Date Sun, 23 Dec 2012 02:15:01 +1100
Subject Re: redirect standard output problem
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1203.1356189305.29569.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356189305 news.xs4all.nl 6841 [2001:888:2000:d::a6]:36782
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35371

Show key headers only | 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