Just continue reading until end-of-file, just like you'd read any other file! 
(for instance when reading a file line-by-line). The PDF is still being 
produced as you read it, so just read on until end of file and append it to 
your buffer. (Perhaps you can read it line-by-line, isn't PDF as sort of text 
format?)

cheers,

--Tim

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Jurgen Kareta
Sent: Monday, May 09, 2005 11:27 AM
To: python-win32 Mailinglist
Subject: [python-win32] win32pipe.popen and stdout


Hi,

I have two questions about win32pipe popen methods and stdin and stdout:

I played with the ps2pdf batch in ghostscript. If I call the batch from 
python with win32pipe.popen, giving two real files as soure and 
destination, it works fine.  Calling the batch with a '-' for 
destination, the output is send to stdout. But if I try to fetch it 
inside python I get only roundabout 300 bytes and the rest is lost (with 
the read method). If I add another read statement I get a few other 
bytes from the stdout.

code:
pipe = win32pipe.popen('..\\ps2pdf.bat test.ps -','r')
msvcrt.setmode(pipe.fileno(),O_BINARY)
pdf_file=pipe.read()
pipe.close()

/code

Is there a way the fetch the hole content of stdout ?

second question:
I'm wondering how to set the stdin for the subprocess:
(input,output) = win32pipe.popen2('my_command input.write(my_content))

would the above statement set the stdin pipe of my_command with my_content ?

thanks in advance
J�rgen



_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to