Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Adam Jensen
On 10/18/2014 02:36 PM, George R Goffe wrote: > Hi, > > When you run a python program, it appears that stdin, stdout, and stderr are > opened automatically. > > I've been trying to find out how you tell if there's data in stdin (like when > you pipe data to a python program) rather > than in a

[Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread George R Goffe
Hi, Wow. Lots of feedback. REALLY GOOD FEEDBACK! This was my first question to this list. Let me clarify my question. I want to use tst.py as follows: tst.py input-file output-file OR cat data-file | tst.py - output-file OR cat data-file | tst.py output-file tst.py input-file output-file works

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread David Rock
* Peter Otten <__pete...@web.de> [2014-10-19 10:05]: > George R Goffe wrote: > > > When you run a python program, it appears that stdin, stdout, and stderr > > are opened automatically. > > > > I've been trying to find out how you tell if there's data in stdin (like > > when you pipe data to a py

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Alan Gauld
On 18/10/14 19:36, George R Goffe wrote: When you run a python program, it appears that stdin, stdout, and stderr are opened automatically. correct. I've been trying to find out how you tell if there's data in stdin Same way you tell if there's data in any file/stream - you read from it.

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Peter Otten
George R Goffe wrote: > When you run a python program, it appears that stdin, stdout, and stderr > are opened automatically. > > I've been trying to find out how you tell if there's data in stdin (like > when you pipe data to a python program) rather than in a named input file. > It seems like mo

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-18 Thread Steven D'Aprano
On Sat, Oct 18, 2014 at 11:36:43AM -0700, George R Goffe wrote: > Hi, > > When you run a python program, it appears that stdin, stdout, and > stderr are opened automatically. > > I've been trying to find out how you tell if there's data in stdin > (like when you pipe data to a python program) r

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-18 Thread wolfrage8...@gmail.com
Are you planning to pipe data to a python program? If so please specify and you will get more complete answers. Specifically I am thinking you want information pertaining to subprocess in the standard library. https://docs.python.org/3/library/subprocess.html On Sat, Oct 18, 2014 at 2:36 PM, Georg

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-18 Thread Ben Finney
George R Goffe writes: > When you run a python program, it appears that stdin, stdout, and > stderr are opened automatically. That's true of any program on a POSIX-compliant operating system. > I've been trying to find out how you tell if there's data in stdin > (like when you pipe data to a py

[Tutor] A question about using stdin/out/err vs named files

2014-10-18 Thread George R Goffe
Hi, When you run a python program, it appears that stdin, stdout, and stderr are opened automatically. I've been trying to find out how you tell if there's data in stdin (like when you pipe data to a python program) rather than in a named input file. It seems like most/all the Unix/Linux comm