Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57447
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <oscar.j.benjamin@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.025 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; 'explicitly': 0.05; 'sys': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'windows': 0.15; 'assembler': 0.16; 'cc:name:python list': 0.16; 'descriptor': 0.16; 'ioerror:': 0.16; 'subject:Line': 0.16; 'subject:Reading': 0.16; 'tty': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'import': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'fine': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'tim': 0.29; "doesn't": 0.30; 'errors': 0.30; 'message- id:@mail.gmail.com': 0.30; '(on': 0.31; 'era': 0.31; 'file': 0.32; 'open': 0.33; '(most': 0.33; "can't": 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'described': 0.36; 'shows': 0.36; 'handle': 0.38; 'recent': 0.39; 'expect': 0.39; 'bad': 0.39; 'here:': 0.62; 'here': 0.66; 'yes': 0.68; 'default': 0.69; 'restore': 0.78; 'oscar': 0.84; 'subject:After': 0.84; 'subject:From': 0.97; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=/PpZppGE/XmAcFX1g7hiM6JRY5qAcZ6Di4yX0WIfqzk=; b=hWKWCYPeohBa1gWpWOZ7nww8plYv+7UEnbweW1bdgwbuNTJ2aN57YKWarZRBsBFyq6 Auot8dWz0FvJ9mC7AGjpyFQdFNz10PGmiu4+ols7SA6OZsgn765KU5a3goVpb7kQYoG+ bNJTDd8BHV+U2y4fn/sTacXc9yBzRY3pb/F8gBxKNxD0UvRgi7qHyVGogUj0q9o/z5wM pw3eYdiESpiX0blQW17f/gPbPLp970UjnkwCaio3PeCuVHsAhQIEYnTbYuEzk0dWZMCk PvfO99J1yx7XlQUaKgzgDB7g1lRnzloKso6JXZ4nkvbNprMUdfDrRj1/Y3CCHU4AaXNf Mmyg== |
| X-Received | by 10.220.250.4 with SMTP id mm4mr12306vcb.47.1382614444722; Thu, 24 Oct 2013 04:34:04 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <52686540.6000401@tundraware.com> |
| References | <7cdlja-j3j2.ln1@ozzie.tundraware.com> <7wli1jemvg.fsf@benfinney.id.au> <CAPTjJmr6VnTvc0rdPmadp5D39igweUAB1jZG_SgLO4qT9ak0Ug@mail.gmail.com> <1382562096.2967.37713425.4901765B@webmail.messagingengine.com> <mailman.1431.1382566824.18130.python-list@python.org> <52686540.6000401@tundraware.com> |
| From | Oscar Benjamin <oscar.j.benjamin@gmail.com> |
| Date | Thu, 24 Oct 2013 12:33:44 +0100 |
| Subject | Re: Reading From stdin After Command Line Redirection |
| To | Tim Daneliuk <tundra@tundraware.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | Python List <python-list@python.org> |
| 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 | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1466.1382614452.18130.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1382614452 news.xs4all.nl 15903 [2001:888:2000:d::a6]:41679 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:57447 |
Show key headers only | View raw
On 24 October 2013 01:09, Tim Daneliuk <tundra@tundraware.com> wrote:
>
> Now that I think about it, as I recall from the prehistoric era of writing
> lots of assembler and C, if you use shell redirection, stdin shows
> up as a handle to the file
Yes this is true. A demonstration using seek (on Windows but it is the
same in this sense):
$ cat test.py
import sys
sys.stdin.seek(0)
print('Seeked fine without errors')
$ python test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
sys.stdin.seek(0)
IOError: [Errno 9] Bad file descriptor
$ python test.py < other.dat
Seeked fine without errors
> and there is no way to retrieve/reset it
> its default association with the tty/pty. Since python is layered on
> top of this, I expect the same would be the case here as well.
I think it is true that you cannot restore the association but you can
just open the tty explicitly as described here:
http://superuser.com/questions/569432/why-can-i-see-password-prompts-through-redirecting-output
(I can't test that right now as it obviously doesn't work on Windows).
Oscar
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-23 12:25 -0500
Re: Reading From stdin After Command Line Redirection Chris Angelico <rosuav@gmail.com> - 2013-10-24 07:40 +1100
Re: Reading From stdin After Command Line Redirection Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 07:46 +1100
Re: Reading From stdin After Command Line Redirection Chris Angelico <rosuav@gmail.com> - 2013-10-24 07:52 +1100
Re: Reading From stdin After Command Line Redirection random832@fastmail.us - 2013-10-23 17:01 -0400
Re: Reading From stdin After Command Line Redirection Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 09:20 +1100
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-23 19:09 -0500
Re: Reading From stdin After Command Line Redirection Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 14:53 +1100
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-23 23:36 -0500
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-23 23:39 -0500
Re: Reading From stdin After Command Line Redirection Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 15:54 +1100
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-24 06:58 -0500
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-24 06:58 -0500
Re: Reading From stdin After Command Line Redirection Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-10-24 13:10 +0100
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-24 08:41 -0500
Re: Reading From stdin After Command Line Redirection feedthetroll@gmx.de - 2013-10-24 07:36 -0700
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-24 09:43 -0500
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-24 08:41 -0500
Re: Reading From stdin After Command Line Redirection Ethan Furman <ethan@stoneleaf.us> - 2013-10-24 07:30 -0700
Re: Reading From stdin After Command Line Redirection Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-10-24 09:14 +0100
Re: Reading From stdin After Command Line Redirection Ben Finney <ben+python@benfinney.id.au> - 2013-10-24 19:43 +1100
Re: Reading From stdin After Command Line Redirection Tim Chase <python.list@tim.thechases.com> - 2013-10-24 05:45 -0500
Re: Reading From stdin After Command Line Redirection Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-10-24 12:33 +0100
Re: Reading From stdin After Command Line Redirection Ethan Furman <ethan@stoneleaf.us> - 2013-10-24 07:39 -0700
Re: Reading From stdin After Command Line Redirection Tim Daneliuk <tundra@tundraware.com> - 2013-10-23 19:09 -0500
Re: Reading From stdin After Command Line Redirection Chris Angelico <rosuav@gmail.com> - 2013-10-24 09:23 +1100
csiph-web