Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
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) availab

Re: stdin, stdout, redmon

2008-01-22 Thread Thynnus
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: > > HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVe

Re: stdin, stdout, redmon

2008-01-22 Thread Konstantin Shaposhnikov
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 > here:http://support.microsoft.com/default.asp

Re: stdin, stdout, redmon

2008-01-22 Thread Konstantin Shaposhnikov
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)

Re: stdin, stdout, redmon

2008-01-22 Thread Rolf van de Krol
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 *befor

Re: stdin, stdout, redmon

2008-01-22 Thread John Machin
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

Re: stdin, stdout, redmon

2008-01-22 Thread Tim Golden
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.p

Re: stdin, stdout, redmon

2008-01-22 Thread Bernard Desnoues
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 i

Re: stdin, stdout, redmon

2008-01-21 Thread Rolf van de Krol
I don't know what you did with your Python installation, but for me this works perfectly. test3.py contains: import sys print sys.stdin.readlines() test.txt contains: Testline1 Testline2 Output of 'python test3.py < test.txt' is: ['Testline1\n', 'Testline2'] Just plain simple and just w

Re: stdin, stdout, redmon

2008-01-21 Thread Bernard Desnoues
Rolf van de Krol a écrit : > According to various tutorials this should work. > > > |import sys > data = sys.stdin.readlines() > print "Counted", len(data), "lines."| > > > Please use google before asking such questions. This was found with only > one search for the terms 'python read stdin' >

Re: stdin, stdout, redmon

2008-01-21 Thread Rolf van de Krol
According to various tutorials this should work. |import sys data = sys.stdin.readlines() print "Counted", len(data), "lines."| 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 go

Re: stdin -> stdout

2005-08-20 Thread Jeff Schwab
max(01)* wrote: > i was wondering, what's the simplest way to echo the standard input to > the standard output, with no modification. ... > ps: in perl you ca do this: > > ... > while ($line = ) > { > print STDOUT ("$line"); > } > ... I guess you could, but there wouldn't be much point.

Re: stdin -> stdout

2005-08-20 Thread Jorgen Grahn
On Fri, 19 Aug 2005 15:26:27 GMT, max(01)* <[EMAIL PROTECTED]> wrote: > hi. > > i was wondering, what's the simplest way to echo the standard input to > the standard output, with no modification. > > i came up with: ... > but i guess there must be a simpler way. > > using bash i simply do 'cat', *

Re: stdin -> stdout

2005-08-19 Thread John Machin
limodou wrote: > 2005/8/19, max(01)* <[EMAIL PROTECTED]>: > >>hi. >> >>i was wondering, what's the simplest way to echo the standard input to >>the standard output, with no modification. >> >>i came up with: >> >>... >>while True: >> try: >> raw_input() >> except EOFError: >> break >>.

Re: stdin -> stdout

2005-08-19 Thread Steven Bethard
gry@ll.mit.edu wrote: > import sys > for l in sys.stdin: > sys.stdout.write(l) This is fine if you don't need the reads and writes of lines to run in lockstep. File iterators read into a buffer, so you'll probably read 4096 bytes from stdin before you ever write a line to stdout. If th

Re: stdin -> stdout

2005-08-19 Thread Steven Bethard
max(01)* wrote: > i was wondering, what's the simplest way to echo the standard input to > the standard output, with no modification. import sys for line in iter(sys.stdin.readline, ''): sys.stdout.write(line) Note that this uses the second form of iter(), which calls its first argument re

Re: stdin -> stdout

2005-08-19 Thread gry
import sys for l in sys.stdin: sys.stdout.write(l) -- George -- http://mail.python.org/mailman/listinfo/python-list

Re: stdin -> stdout

2005-08-19 Thread Dan Sommers
On Fri, 19 Aug 2005 15:26:27 GMT, "max(01)*" <[EMAIL PROTECTED]> wrote: > ps: in perl you ca do this: > ... > while ($line = ) >{ > print STDOUT ("$line"); >} > ... import fileinput import sys for line in fileinput.input(): sys.stdout.write(line) Regards, Dan -- Dan Sommers

Re: stdin -> stdout

2005-08-19 Thread limodou
2005/8/19, max(01)* <[EMAIL PROTECTED]>: > hi. > > i was wondering, what's the simplest way to echo the standard input to > the standard output, with no modification. > > i came up with: > > ... > while True: >try: > raw_input() >except EOFError: > break > ... > > but i guess

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread chuck
"common wisdom" interesting. The value of the closed attribute is "False" when tested from within the service. Still digging -- http://mail.python.org/mailman/listinfo/python-list

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread Jeff Epler
It seems to simply be common wisdom. e.g., http://mail.python.org/pipermail/python-win32/2004-September/002332.html http://mail.mems-exchange.org/pipermail/quixote-users/2004-March/002743.html http://twistedmatrix.com/pipermail/twisted-python/2001-December/000644.html etc If you can find chapter

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread chuck
Interesting. The stdin and stdout objects in my service seems respond to returing a string for the statements str(sys.stdin) and str(sys.stdout). I guess they are just not attached to files? Can you provide a reference (MSDN or otherwise) that indicates that Windows Services don't have standard

Re: stdin/stdout fileno() always returning -1 from windows service

2005-07-18 Thread Jeff Epler
On Sun, Jul 17, 2005 at 06:43:00PM -0700, chuck wrote: > I have found that sys.stdin.fileno() and sys.stdout.fileno() always > return -1 when executed from within a win32 service written using the > win32 extensions for Python. > > Anyone have experience with this or know why? because there *is*