spawnv output redirection?

j vickroy jvickroy at sec.noaa.gov
Tue Aug 8 11:58:11 EDT 2000


Hello Ben,

>From pages 325,326 of "Python Programming on Win32" by Mark Hammond and Andy
Robinson, it appears that the os.popen module or the win32pipe module may be
of use.  Here are 2 examples from the book:

import os
file = os .popen ('echo Hello from Python')
file .read()
... 'Hello from Python'

import win32pipe
file = win32pipe. popen ('echo Hello from Python')
file .read()
... 'Hello from Python\012'

According to the book, os.popen does not work correctly within a GUI
application while win32pipe.popen does.

Hope this helps.


Ben Mitchell wrote:

> Hi Folks,
>
> I'm writing a script where I'm calling spawnv to run a sub program.  It
> turns out that this program dumps all kinds of stuff to stdout and stderr
> that I don't want my users to have to look at.
>
> So my question is: How would one go about preventing output of a program
> called through spawnv from getting printed to the console?
>
> Thanks in advance,
>
> -Ben




More information about the Python-list mailing list