Pythonのお勉強 Part11
■ このスレッドは過去ログ倉庫に格納されています
0575デフォルトの名無しさん
2006/08/23(水) 14:44:58勘違い鴨だけど urllib2 は HTTP の接続をちゃんと閉じてない希ガス。
試しに以下のようなコードを入れてみたらどーでしょ。
class HTTPHandler(urllib2.HTTPHandler):
def http_open(self, req):
return self.do_open(self.http_class, req)
def http_class(self, host):
self._conn = httplib.HTTPConnection(host)
return self._conn
def close(self):
self._conn.close()
#print "closed"
handler = HTTPHandler()
urllib2.install_opener(urllib2.build_opener(handler))
def urlget(url, file):
:
handler.close() # XXX
return os.path.getsize(file) - size
■ このスレッドは過去ログ倉庫に格納されています