Pipe error codes off by a factor of 256

Ben Glazer glazer at scicomp.com
Thu Dec 16 13:13:46 EST 1999


I'm trying to capture the error code from a pipe opened with os.popen().

I can successfully store the returned code in a variable, but the
returned code always is exactly 256 times larger than it should be.

i.e., if I should be receiving an error value of 1, I actually receive
256.  If I should receive 2, I actually receive 512.  And so on.

I can work around this bug by following any error capture with this
line:

    if err: err = err / 256

However, it isn't really an optimal situation to include this line
every time I store an error code.

Has anyone witnessed this strange behavior before?  Is there a way to
fix this problem?


Thanks,
Ben


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list