return values of os.system() on win32

Paul Watson pwatson at redlinepy.com
Fri Jan 13 14:06:12 EST 2006


rbt wrote:
> Is it safe to say that any value returned by os.system() other than 0 is 
> an error?
> 
> if os.system('winver') != 0:
>     print "Winver failed!"
> else:
>     print "Winver Worked."
> 
> Thanks!

What are you really seeking to do?  Are you wanting to detect if your 
code is running on a Windows machine?  Are you wanting to know the 
version number of Windows?  Why not use popen2() and see the output?



More information about the Python-list mailing list