Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Basically the value you want is shifted up 8 bits. Perhaps I should more > understandably have said: > >12 << 8 == 3072 Or as already suggested in other followups, use os.WEXITSTATUS (and os.WIFEXITED.) Not only doe

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
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 res

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Scott David Daniels
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. F

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
ok, I was thinking of shifting using subprocess, guess I'd better do that and forget about this waste of time. thanks Hari Sekhon Fredrik Lundh wrote: Hari Sekhon wrote: I'm sorry, this may seem dense to you but I have to ask. What on earth are you talking about? >

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Martin v. Löwis
Hari Sekhon schrieb: > I'm sorry, this may seem dense to you but I have to ask. What on earth > are you talking about? You may not be dense, but you are certainly fairly aggressive in your postings. If you just want to complain, go ahead. If you want actual help, you should reconsider your tone.

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Fredrik Lundh
Hari Sekhon wrote: > I'm sorry, this may seem dense to you but I have to ask. What on earth > are you talking about? > > Why is it shifted 8 bits to the left? Why is there bitshifting at all? > Why doesn't commands give the same exit value as os.system() and the > unix cli? because that's how

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
I'm sorry, this may seem dense to you but I have to ask. What on earth are you talking about? Why is it shifted 8 bits to the left? Why is there bitshifting at all? Why doesn't commands give the same exit value as os.system() and the unix cli? When you choose to exit a program you give it a re

Re: *** Spam *** Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Steve Holden
A famous Holden typo - it should have been "12 * 256 == 3072", but really it shouldn't have been beyond you to perform a division of 3072 by 12 (given that you already knew the number 12 was potentially involved). Basically the value you want is shifted up 8 bits. Perhaps I should more understa

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
I don't quite understand what you are saying here: 2 * 256 is 512, 2 ** 256 is some extremely large number. 2**12 is 4096. So how does 3072 factor into this? Could you explain what you mean by "the error in the top half of a sixteen-bit value"? This makes no sense to me at this moment. -h

Re: commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Steve Holden
Hari Sekhon wrote: > I'm running a command like > > import commands > result = commands.getstatusoutput('somecommand') > print result[0] > 3072 > > > However, this exit code made no sense so I ran it manually from the > command line in bash on my linux server and it gives the exit code as > 12

commands.getstatusoutput result is not command line exit value!!!

2006-10-02 Thread Hari Sekhon
I'm running a command like import commands result = commands.getstatusoutput('somecommand') print result[0] 3072 However, this exit code made no sense so I ran it manually from the command line in bash on my linux server and it gives the exit code as 12, not this weird 3072 number. So I tried