Module for generic platform information: platform.py

Betancourt, Josef Josef.Betancourt at GTECH.COM
Thu Oct 28 10:05:36 EDT 1999


> -----Original Message-----
> From: M.-A. Lemburg [mailto:mal at lemburg.com]
> "Betancourt, Josef" wrote:
> > 
> > I use the following code.  Its kludgy and I'm a Python 
> newbie, but so far it
> > works, so.....
> > ...
> >     if on98 :
> >         program = os.popen(cmdl, 'r')
> >     elif onNT :
> >         program = os.popen('( ' + cmdl + ' ) 2>&1', 'r')
> >     else:
> >         program = os.popen('{ ' + cmdl + '; } 2>&1', 'r')
> > ...
> 
> Is that how one can do redirection on Windows NT ? Would be 
> interesting
> to add in order to avoid silly notices being printed to stderr.
> 

Yes.  I actually use the stderr capture for error control since I cannot
rely solely on the return status code in a usable manner.    For example, I
call make and other utilities, capture the outputs, grep it using re, then
if all goes well, use Python's smtp and FTP to distribute and report on the
process.

----------------------------------

BTW, the latest functionaly added to the program is to capture snapshots
before and after the process and report.  Tried using Unix commands but it
quickly got too complex and may not have been usable on NT Unix shells.
The output is a listing for each category:  deleted, added, changed,
unchanged

I was thinking of adding this to the snippets, but since this is so useful
(maybe), I'm sure there are plenty of utilities that do this.(?)










More information about the Python-list mailing list