I have tried
import urllib.request
or
import urllib
The path for my urllib is
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/__init__.py
I am wondering where is urlopen, or is my python module pointing to the wrong file?
os.listdir(os.path.dirname(urllib.__file__))? - mgilson['__init__.py', '__pycache__', 'error.py', 'parse.py', 'request.py', 'response.py', 'robotparser.py']- user1999806import sys;print(sys.path)and see if any python 2 related paths appear? if so, perhaps you've got something unusual set in your PYTHONPATH in your shell environment? - ben authorimport urllib.request; urllib.request.urlopenworks fine for me.import urllib; urllib.request.urlopenwould raise theAttributeErrorthat you are seeing. - mgilsonimport urllib; from urllib.request import urlopenwhich is kind of odd but it worked! - user1999806