return values of os.system() on win32
Peter Hansen
peter at engcorp.com
Fri Jan 13 12:06:43 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."
According to the docs, assuming that *in general* would be an error, but
it's likely that for the sorts of cases you are talking about, it's true.
Ultimately, since the return code is generally under the control of the
application you're calling, it's absolutely possible (likely) that there
are many programs which do not work as you assume above, and probably a
large number which don't ever explicitly set the return value at all...
-Peter
More information about the Python-list
mailing list