Hello,
I checked under linux and it works :
text.txt :
first line of the text file
second line of the text file
test.py :
import sys
a = sys.stdin.readlines()
x = ''.join(a)
x = x.upper()
sys.stdout.write(x)
cat text.txt | python test.py
But I reinstalled Python 2.5 under Windows XP and it
Bernard Desnoues wrote:
Hello,
I checked under linux and it works :
text.txt :
first line of the text file
second line of the text file
test.py :
import sys
a = sys.stdin.readlines()
x = ''.join(a)
x = x.upper()
sys.stdout.write(x)
cat text.txt | python test.py
But I
On Jan 22, 8:42 pm, Bernard Desnoues [EMAIL PROTECTED]
wrote:
Hello,
I checked under linux and it works :
text.txt :
first line of the text file
second line of the text file
test.py :
import sys
a = sys.stdin.readlines()
x = ''.join(a)
x = x.upper()
sys.stdout.write(x)
cat text.txt
Well, that's at least weird. I did test my code with Python 2.5 on Win
XP, using the command prompt. But testing it with IDLE gives exactly the
same error Bernard has. So apparently STDIN can't be accessed with IDLE.
Rolf
John Machin wrote:
Excuse me, gentlemen, may I be your referee
Hi,
This is Windows bug that is described here:
http://support.microsoft.com/default.aspx?kbid=321788
This article also contains solution: you need to add registry value:
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies
\Explorer
InheritConsoleHandles = 1 (REG_DWORD type)
Sorry, I meant:
Alternatively you can use following command
cat file | python script.py
instead of
cat file | script.py
On Jan 22, 1:54 pm, Konstantin Shaposhnikov [EMAIL PROTECTED]
wrote:
Hi,
This is Windows bug that is described
On 1/21/2008 9:02 AM, Bernard Desnoues wrote:
Hi,
I've got a problem with the use of Redmon (redirection port monitor). I
intend to develop a virtual printer so that I can modify data sent to
the printer.
FWIW: there is a nice update the RedMon (v1.7) called RedMon EE (v1.81)
available
On 1/22/2008 8:54 AM, Konstantin Shaposhnikov wrote:
Hi,
This is Windows bug that is described here:
http://support.microsoft.com/default.aspx?kbid=321788
This article also contains solution: you need to add registry value:
Hi,
I've got a problem with the use of Redmon (redirection port monitor). I
intend to develop a virtual printer so that I can modify data sent to
the printer.
Redmon send the data flow to the standard input and lauchs the Python
program which send modified data to the standard output (Windows
According to various tutorials this should work.
code
|import sys
data = sys.stdin.readlines()
print Counted, len(data), lines.|
/code
Please use google before asking such questions. This was found with only
one search for the terms 'python read stdin'
Rolf
Bernard Desnoues wrote:
Hi,
I've
Rolf van de Krol a écrit :
According to various tutorials this should work.
code
|import sys
data = sys.stdin.readlines()
print Counted, len(data), lines.|
/code
Please use google before asking such questions. This was found with only
one search for the terms 'python read stdin'
I don't know what you did with your Python installation, but for me this
works perfectly.
test3.py contains:
code
import sys
print sys.stdin.readlines()
/code
test.txt contains:
code
Testline1
Testline2
/code
Output of 'python test3.py test.txt' is:
code
['Testline1\n', 'Testline2']
/code
12 matches
Mail list logo