What is the actual type of "interrupted system call"?
Jeff McNeil
jeff at jmcneil.net
Tue Jun 9 15:06:00 EDT 2009
On Jun 9, 2:22 pm, mrstevegross <mrstevegr... at gmail.com> wrote:
> I'm trying to write a try/catch block to handle an "interrupted system
> call". However, I can't seem to locate information on the actual
> typename of the exception. Does anyone know what it would be? I want
> my code to look like this:
>
> try:
> ...
> except InterruptedSystemCall # what's the right name?
> ...
>
> Thanks,
> --Steve
You'll get that error when an async. event (signal) is delivered to
your application during a system call. It's a result of 'errno' being
set to errno.EINTR (4). I check for a few such specific conditions in
some of my code and I usually do it like so:
try:
....
except EnvironmentError, e:
if e.errno == errno.EINTR:
do_something_with_eintr_error()
else:
raise
That works for me. There isn't an "InterruptedSystemCall" error or
equivalent in the standard exception hierarchy. EnvironmentError is
the parent of OSError & IOError, which is where you'll most likely be
encountering that state.
Thanks,
Jeff
mcjeff.blogspot.com
More information about the Python-list
mailing list