[Python-bugs-list] stdin and arguments (PR#78)

frido@nl.euro.net frido@nl.euro.net
Mon, 13 Sep 1999 03:00:16 -0400 (EDT)


> > When using python to pipe some source code like so:
> > 
> > cat test.py | python - foo bar
> > 
> > it doesn't give the arguments foo and bar too test.py but thinks
> > it is another source file, resulting in a file not found error.
> 
> On what platform?  I can't reproduce this.  If my file test.py
> contains "import sys; print sys.argv" it correctly prints ['-', 'foo',
> 'bar'].  This on Solaris.  I'm pretty sure the behavior is the same
> across Unix.  On Windows, I indeed get the error you report -- but
> your mention of ssh makes me doubt that you are on Windows.

-=-=-=-
nightfall: ~ $ cat bla.py 
#!/usr/bin/python

import sys

print sys.argv
nightfall: ~ $ cat bla.py | python - test
python: can't open file 'test'
nightfall: ~ $ cat bla.py | python -- - test
['-', 'test']
nightfall: ~ $ uname -a
Linux nightfall.euronet.nl 2.2.6-15apmac #1 Mon May 31 03:54:09 EDT 1999 ppc unknown
-=-=-=-

Python 1.5.1 (#1, Apr 19 1999, 03:44:48)  [GCC egcs-2.91.66 19990314 
(e on linux-ppc)

Tested on Linux/intel and Linux/ppc (Redhat/LinuxPPC) :( , both produce the 
same error. Solaris seems to work. Don't know about freeBSD yet. 

Thanx, Frido
                                   .
                                  *
 Frido Ferdinand                ***             EuroNet Internet BV
 Implementation Team         .*******'          Herengracht 208 - 214
 frido@nl.euro.net             ** **            1016 BS Amsterdam
                             .*     *.          T: +31 20 5355555