Changeset eeeb30e for skype/skyped.py


Ignore:
Timestamp:
2008-01-12T21:18:21Z (17 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
57f0440
Parents:
10a42d9
Message:

skyped: catch KeyboardInterrupts everywhere

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.py

    r10a42d9 reeeb30e  
    3838from ConfigParser import ConfigParser
    3939from OpenSSL import SSL
     40from traceback import print_exception
     41#from exceptions import KeyboardInterrupt
    4042
    4143__version__ = "0.1.1"
     
    4345SKYPE_SERVICE = 'com.Skype.API'
    4446CLIENT_NAME = 'SkypeApiPythonShell'
     47
     48def eh(type, value, tb):
     49        if type == KeyboardInterrupt:
     50                sys.exit("Exiting.")
     51        print_exception(type, value, tb)
     52        sys.exit(1)
     53
     54sys.excepthook = eh
    4555
    4656def input_handler(fd, io_condition):
     
    6171        except Skype4Py.SkypeAPIError, s:
    6272                dprint("Warning, pinging Skype failed (%s)." % (s))
    63         try:
    6473                time.sleep(2)
    65         except KeyboardInterrupt:
    66                 sys.exit("Exiting.")
    6774        return True
    6875
Note: See TracChangeset for help on using the changeset viewer.