[pygtk] PyGTK and urllib
Tue, 18 Jul 2000 12:51:13 +0200
James Henstridge wrote:
> On Mon, 17 Jul 2000, Martijn Faassen wrote:
> Unless I am mistaken, urllib is a syncronous interface, so it will not
> return until it has completed the transfer. This means your application
> will not process any events (mouse clicks, expose events, etc) until the
> transfer completes, which is what is causing your problems.
It's not just my application, it's *X* that isn't responsive.
Window manager, Gnome desktop, everything. That's symptom number 1.
Symptom number 2 is that urlopen() takes a lot *longer* than when run
outside the Gnome app. It would've made sense if my application wasn't
responding; in fact that happens with the first call to urlopen() that
I do. But the other call really blocks most of X.
> You should either use an asyncronous transfer (using the
> input_add() function to set up a handler for when information comes in on
> the socket), or look at using threads.
I already tried to solve this with threads; I'm a new thread programmer,
but still it doesn't seem to make any difference whatsover;
X still hangs solid, whether I run urlopen() inside a thread or
I'll whip up some demo code that tries to demonstrate this effect soon.