Pipe error codes off by a factor of 256
Skip Montanaro
skip at mojam.com
Thu Dec 16 14:00:21 EST 1999
Ben> I'm trying to capture the error code from a pipe opened with
Ben> os.popen(). I can successfully store the returned code in a
Ben> variable, but the returned code always is exactly 256 times larger
Ben> than it should be.
That's the way the underlying popen works, and it's documented, sort of.
>From the os lib reference page:
The exit status of the command (encoded in the format specified for
wait()) is available as the return value of the close() method of the
file object, except that when the exit status is zero (termination
without errors), None is returned.
Unfortunately, I don't find any documentation on wait's return status.
More information about the Python-list
mailing list