Python 3.5.1 urllib has no attribute request

后端 未结 6 1494
礼貌的吻别
礼貌的吻别 2020-12-17 08:19

I have tried

import urllib.request

or

import urllib

The path for my urllib is /Library/Framework

6条回答
  •  盖世英雄少女心
    2020-12-17 08:39

    If nothing above worked for you, try renaming your python module.

    In my particular case, the issue was that the file I was running was called http.py. Once I changed the name to test-http.py, importing urllib.request resolved the error AttributeError: module 'urllib' has no attribute 'request'

    I had noticed that further up the exception trace the internal packages were trying to fetch a module called http, so guessing my module's name was wonkin stuff up...

提交回复
热议问题