I will be grateful for any help. I use Python 3.4.1 and I try to import urllib.request and urllib.parse. Without success. I always receive:
Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 2218, in _find_and_load_unlocked AttributeError: 'module' object has no attribute '__path__' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words/importowanie.py", line 1, in <module> import urllib.parse File "C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words\urllib.py", line 1, in <module> import urllib.request ImportError: No module named 'urllib.request'; 'urllib' is not a package
I guess the problem is with importing but I don't know how to go around it
Without the actual code, I am guessing based on my past experience with such an error.
I presume you are trying to import urllib.parse
in a file called importowanie.py
in C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words
. When Python tries to import a module by the name urllib
, it first checks in the same folder from where you are trying to import. In your case, it sees that there is a module called urllib
in the same folder from where you are trying to import it. It sees inside that module instead of the "real" urllib. As it sees nothing called parse inside your urllib
it raises an error.
It is because of a file called urllib.py
in C:/Users/x/Documents/PROGRAMING and MODELING/Phyton/find cure words
.
So a solution would be to rename urllib
in the above directory to something else and try again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With