Yet another Tkinter and threads question

Nicholas Haggin nhaggin at attbi.com
Tue Sep 17 22:42:41 EDT 2002


After a short perusal of the group archives I haven't found anything
answering the following, so here goes:

I am polishing up the GUI for a client that uses FTP to submit MVS
jobs to an IBM S/390, and am adding message boxes for exceptional
circumstances i.e., user mistyped password, connection timeout, etc.
To prevent locking up the GUI, all submissions spawn a thread, which
calls a wrapper function around ftplib that does the right
site-specific hanky-panky to make everything go smoothly. In the
thread function, the code goes something like this:

try:
    submit_job()
except socket.error:
    showerror("Socket has barfed")
except ftplib.error_perm:
    showerror("You mistyped your password")

The call to showerror locks the program. Any thoughts? Older posts on
other threading+GUI questions had mentioned that Tk was not
thread-safe; has it become so, or is this still a tar-pit?

Nick

A.M.D.G.



More information about the Python-list mailing list