libb.timeout

class timeout(seconds=100, error_message='Timeout!!')[source]

Bases: object

Context manager for timing out potentially hanging code.

Parameters:
  • seconds (int) – Timeout in seconds (default: 100).

  • error_message (str) – Message for timeout error.

Warning

Uses SIGALRM and only works on Unix/Linux systems.

handle_timeout(signum, frame)[source]