0

When I import urllib.request in python 3, I get the following error:

Traceback (most recent call last):
  File "urllibExample.py", line 1, in <module>
    import urllib.request
  File "/home/andrew/Python/urllib.py", line 1, in <module>
    import urllib.request, urllib.parse, urllib.error
ModuleNotFoundError: No module named 'urllib.request'; 'urllib' is not 
a package

I'm not sure why I'm getting this error message since urllib.request is in the standard library. Does anyone know how to fix this?

Andrew
  • 1
  • 3

1 Answers1

1

You appear to have a file of your own named urllib.py. The import is being attempted from this file instead of the system installed one.

Rename your file.

mhawke
  • 84,695
  • 9
  • 117
  • 138