python 多线程时,urllib2的古怪问题

 如果服务器限制了并发为1,并且满足如下条件

setDaemon(True)
如果一个线程类里有这一句
并且该类里有urllib2的请求
那么第2次实例化后,urllib2的urlopen方法就不能使用了。
否则会报错,错误如下

Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
  File "C:/Python25/lib/threading.py", line 486, in __bootstrap_inner
  File "D:/pysrc/pytest/test_urllib2.py", line 78, in run
  File "C:/Python25/lib/ByteRangeDownload.py", line 116, in get
  File "C:/Python25/lib/ByteRangeDownload.py", line 46, in getFileSize

你可能感兴趣的:(python)