猿问

有一些模块好像和老师的不一样,是不是我用错了 求大神赐教

Traceback (most recent call last):

  File "G:/PyCharm/workspace/baike_spider/spider_main.py", line 45, in <module>

    obj_spider.craw(root_url)

  File "G:/PyCharm/workspace/baike_spider/spider_main.py", line 27, in craw

    html_cont = self.downloader.download(new_url)

  File "G:\PyCharm\workspace\baike_spider\html_downloader.py", line 14, in download

    response = urllib.request.urlopen(url)

  File "G:\Python36\lib\urllib\request.py", line 223, in urlopen

craw 1 : <bound method UrlManager.get_new_url of <url_manager.UrlManager object at 0x000001BDA7F82A58>>

    return opener.open(url, data, timeout)

  File "G:\Python36\lib\urllib\request.py", line 517, in open

    req.timeout = timeout

AttributeError: 'method' object has no attribute 'timeout'


Process finished with exit code 1

上面是错误信息 下面是它说出错的地方。最后两个定位在 request模块里  让我有点懵逼

https://img2.mukewang.com/5c3ff3210001df7207820265.jpg

https://img4.mukewang.com/5c3ff33e0001831b05610247.jpg

https://img2.mukewang.com/5c3ff38c000111fd06270369.jpg

https://img1.mukewang.com/5c3ff3a50001484d07560246.jpg


supbad
浏览 1164回答 2
2回答
随时随地看视频慕课网APP
我要回答