Module for generic platform information: platform.py
M.-A. Lemburg
mal at lemburg.com
Wed Oct 27 12:30:41 EDT 1999
Thomas Heller wrote:
>
> > Thomas Heller wrote:
> > >
> > > I searched the MSDN again,
> > > it seems that winmsd.exe is included in NT 3.5, 3.51, 4.0
> > > and installed by default.
> >
> > Sound even better ;-) (It doesn't seem to exist on Win95, so I'll
> > only use it for WinNT.)
> >
> > What command string would I have to pass to os.popen to get the output
> > (I only need the first few lines) without any windows popping up ?
> >
> That's were the problem (mentioned earlier) start. This is windows here,
> so do not expect for programs to write to stdout!
>
> As I said before, winmsd writes its output to the file <hostname>.txt.
> AFAIK, you cannot pipe the output somewhere else, nor can you change the
> name of this file.
>
> The following script demonstrates how to do it:
>
> import string, os, sys
> hostname = string.strip (os.popen ("hostname && winmsd /s /f").read())
> file = open (hostname + '.txt')
> for i in range (12):
> sys.stdout.write (file.readline())
>
> The output on my system are:
>
> Microsoft Diagnostics Report For \\THOMASNOTEBOOK
> ----------------------------------------------------------------------
>
> OS Version Report
> ----------------------------------------------------------------------
> Microsoft (R) Windows NT (TM) Workstation
> Version 4.0 (Build 1381: Service Pack 4) x86 Uniprocessor Free
> Registered Owner: Thomas Heller, ION-TOF GmbH
>
> BUT: Be prepared to receive this in other languages!
> AND: winmsd displays a progress dialog window like this
>
> +--------------------------+
> | Generating WinMSD report |
> | +-------+ |
> | | Cancel| |
> +----+-------+-------------+
>
> which closes automatically after the second or so, when the report
> is complete. I did not find a way to suppress this window.
> Hope this helps,
Well it does, but I don't think weird windows popping up when
calling a Python function is not really tolerable. Having the
program write to a fixed filename is even less -- you'd write
that file (which contains private data I suppose) into the
current dir which could be just about anywhere...
Perhaps some of the win32 wizards out there could help out
with a function that gets this data from the registry (either
direct via MarkHs win32 package or indirect via "regedit") ?
Anyway, thanks for looking into this, Thomas.
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 65 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/
More information about the Python-list
mailing list