Indeed, I did the experiment again with
while 1:
y = os.system("sleep 1")
print y
and it ALWAYS returns 0, with control-c or without.
>From past experience, I am pretty sure that in other cases I have been
getting non-zero return values. So I would hesitate to believe that
what you observe i
Thanks for the tips everyone, although it turns out this is not a python
problem at all. After several tests with mpg123 both direct on the cli, and
wrapped in an os.system() call, I see it is _always_ returning 0 exit status
whether I interrupt it or not. I went to the mpg123 website to see if
In article <[EMAIL PROTECTED]>,
"malv" <[EMAIL PROTECTED]> wrote:
> That's also kind of what I expected.
> However, I quickly tried:
> import os
> while 1:
> y = os.system("sleep 1")
> z = (y >> 8) & 0xFF
> print z
>
> I never get anything in return but 0, hitting c-C or not.
> I h
That's also kind of what I expected.
However, I quickly tried:
import os
while 1:
y = os.system("sleep 1")
z = (y >> 8) & 0xFF
print z
I never get anything in return but 0, hitting c-C or not.
I have uset the above code to get exit code returns in the past though.
Would there be any
[EMAIL PROTECTED] wrote:
> You can tell by the exit code from system() whether the subprocess
> exited due to a signal. Consider this code:
> import os
> while 1:
> print os.system("sleep 1")
> unless you happen to hit ctrl-c at the right time, you'll see it print
> "2" (and "0" wh
You can tell by the exit code from system() whether the subprocess
exited due to a signal. Consider this code:
import os
while 1:
print os.system("sleep 1")
unless you happen to hit ctrl-c at the right time, you'll see it print
"2" (and "0" when the sleep finishes). The exit code
darren kirby wrote:
> Hello all.
>
> I have a python script here which is just a wrapper for 2 or more system
> commands. I would estimate the program spends at least 95.5% of 'real' time
> running the system commands.
>
> I want to trap the [crtl-c] key combo and exit (somewhat) gracefully if
Hello all.
I have a python script here which is just a wrapper for 2 or more system
commands. I would estimate the program spends at least 95.5% of 'real' time
running the system commands.
I want to trap the [crtl-c] key combo and exit (somewhat) gracefully if the
user decides to abort the pro