interruptingcow 0.5

A watchdog that interrupts long running code

  Add it to your Download Basket!

 Add it to your Watch List!

0/5

Rate it!
send us
an update
LICENSE TYPE:
MIT/X Consortium License 
USER RATING:
UNRATED
  0.0/5
DEVELOPED BY:
Erik van Zijst
HOMEPAGE:
bitbucket.org
CATEGORY:
ROOT \ Programming \ Debuggers
interruptingcow is a generic Python utility that can relatively gracefully interrupt your code when it doesn't execute within a specific number of seconds:

from interruptingcow import timeout

try:
 with timeout(5):
 # perform a potentially very slow operation
 pass
except RuntimeError:
 print "didn't finish within 5 seconds"


Installation

 pip install interruptingcow

Caveats

Interruptingcow uses signal(SIGALRM) to let the operating system interrupt program execution. This has the following limitations:

1. Python signal handlers only apply to the main thread, so you cannot use this from other threads
2. You must not use this in a program that uses SIGALRM itself

Last updated on June 13th, 2012

requirements

#watchdog interrupt #Python debugger #Python #watchdog #interrupt #debugger

Add your review!

SUBMIT