commands.getstatusoutput result is not command line exit value!!!
hpsekhon at googlemail.com
Mon Oct 2 19:51:00 CEST 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.
Scott David Daniels wrote:
> Steve Holden wrote:
>> Hari Sekhon wrote:
>>> I'm running a command like
>>> import commands
>>> result = commands.getstatusoutput('somecommand')
>>> print result
>> 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...
More information about the Python-list