
Ab Python 2.3 kann man ja mit socket.setdefaulttimeout(1) einen Timeout auch für urllib "setzten". Leider hab ich auf dem Server nur Python 2.2.x :( Ich brauche aber auch dafür einen Timeout bei einem urllib.urlopen()... Nun hab ich mir gedacht, das man es mit threading machen könnte: =========================================================== import urllib, threading class urlopen(threading.Thread): def __init__( self, url, timeout ): self.url = url threading.Thread.__init__(self) self.start() self.join( timeout ) self.stop() def run(self): self.u = urllib.urlopen( self.url ) def stop( self ): print "soll gestoppt werden..." print "Starte..." page = urlopen( "http://192.168.0.0", 1 ) print "OK" =========================================================== Aber wie kann ich einen blockierten urlopen() bei stop() anhalten??? _______________________________________________ python-de maillist - python-de@python.net http://python.net/mailman/listinfo/python-de