commands.getstatusoutput result is not command line exit value!!!
Hari Sekhon
hpsekhon at googlemail.com
Mon Oct 2 13:51:00 EDT 2006
yes already noted by Steve, thanks.
I should have spotted that myself straight away but I was too wrapped up
in this whole "I didn't realise there were 2 sets of numbers" thing,
gotta go read some unix programming books it would seem this is a os
function that I am not aware of.
I still reserve the right to be annoyed at commands for not hiding this
from me like everything else, but then </F> is right (as always it would
seem) I should not be using such a deprecated thing like commands, I
will switch to subprocess...
I'm even more surprised since I do so much shell scripting and I've
never even heard of this thing before, I guess only the really
battle-scarred old skool ones may know of it.
-h
Hari Sekhon
Scott David Daniels wrote:
> Steve Holden wrote:
>
>> Hari Sekhon wrote:
>>
>>> I'm running a command like
>>>
>>> import commands
>>> result = commands.getstatusoutput('somecommand')
>>> print result[0]
>>> 3072
>>>
> ...
>
>> No, it's just returning the error code in the top half of a sixteen-bit
>> value. You will notice that 3072 == 2 * 256.
>>
> For the rest of us playing along at home, there is a typo there:
> The preceding line should read:
> > value. You will notice that 3072 == 12 * 256.
>
> --Scott David Daniels
> scott.daniels at acm.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061002/b0224ae5/attachment.html>
More information about the Python-list
mailing list