[Tutor] setting up a timer
Lloyd Kvam
pythontutor@venix.com
Tue, 02 Jul 2002 19:47:02 -0400
John, I haven't tried your suggestion yet. My code includes checking if
the sql server is running with the correct configuration and restarting
it when necessary. So I thought covering it all with one timer would be
simpler.
I implemented a timer to catch a connection/startup failure. I tested using
a while 1: loop to simulate a connection/startup failure. The timer did
get triggered and it raised an exception. However, raising an
exception doesn't terminate the process. Is there a way to kill a thread?
Or is there some documentation about using exceptions with threads?
John Pertalion wrote:
> Hello,
>
> I've used timeoutsocket.py module when connecting to a MySQL database over a
> questionable network (the Internet). It lets you define a timeout in
> seconds for ALL socket connections. It throws a timeoutsocket.Timeout
> exception when the connection isn't made within the timeout. And has worked
> great for me with connections using MySQLdb and smtplib. Available at
> http://www.timo-tasi.org/python/timeoutsocket.py
>
> John Pertalion
>
>
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice:
603-443-6155
fax:
801-459-9582
--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358
voice:
603-443-6155
fax:
801-459-9582