why tkinter hangs on windows with tcl server socket?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

why tkinter hangs on windows with tcl server socket?

Bryan Oakley-2
I’m running the following program on Windows, and when I close the app
by clicking on the window manage close button the app hangs. Obviously
this isn’t my real code, but I can’t explain why the code is hanging,
or what the workaround is to get it to not hang.  Interestingly, the
last line of code is executing, so the main loop is terminating but
the python process refuses to die – I’m having to kill it via the task
manager. Even explicitly calling sys.exit() has no effect.

Notice how I create a server socket, then immediately close the
socket. No client is connecting to the server.  It doesn’t matter that
I close it or not, or if I close it after some period of time, it is
the creation of the socket that seems to cause tkinter to hang.

Any ideas?

This is with python 2.7.2.5 from ActiveState, FWIW.

# --- the code ---
import Tkinter as tk

root = tk.Tk()
root.eval('''
    proc Server {args} {puts "Server... $args"}
    set ::the_socket [socket -server Server 0]
    close $::the_socket
''')
root.mainloop()
print "mainloop has exited"
# --- end of the code ---
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss