[pygtk] PyGTK and urllib

who noway acano@systec.com
Mon, 17 Jul 2000 17:22:49 -0400


On Mon, 17 Jul 2000 21:57:28 +0200, Martijn Faassen <faassen@vet.uu.nl> wrote:
> Hi there,
> 
> I've run into an odd problem with urllib.urlopen() apparently taking a *lot*
> more time when used through PyGTK (using LibGlade and Gnome) than when
> I call the same routine through python only. In fact, if I call 
> urlopen() through the Gnome interface, *everything* in X seems to become
> unresponsive; the only thing I can move around is the mouse cursor, but
> since I can't click anything, it's not very useful.
> 
> Oddly enough in the same app I call urlopen() somewhere else that doesn't
> cause this kind of blocking. But I did whittle down my code and it *does*
> seem to be urlopen() in the second case.
> 
> Anyone have any suggestions?
> 
> Regards,
> 
> Martijn
> 
> 
> _______________________________________________
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> 

I had a similar problem.  I had a non-blocking socket and used
while events_pending(): mainiteration()  combo to keep the app
from freezing up, but this would sometimes make X unresponsive:

ret = select.select ([my_socket], [], [], 0.2)
if ret != ([], [], []):
	dat = s.recv (8192)
	...
else:
	while events_pending():
		mainiteration ()
	...


I think it was during connect calls that X would become unresponsive.
The problem was fixed when I upgraded my libs.
I had originally been using gtk 1.2.1 and pygtk 0.5.12 
With gtk 1.2.7 and pygtk 0.6.5  things seem to be ok.