Technical questionAccepted answer
How to fix AttributeError: partially initialized module?
Karthik Bhandary
Jan 16
0 views1
I am trying to run my script but keep getting this error:
File ".\checkmypass.py", line 1, in <module>
import requests
line 3, in <module>
response = requests.get(url)
AttributeError: partially initialized module 'requests' has no attribute 'get' (most likely due to a circular import)
How can I fix it?
1 answer
Accepted answer · original discussion
Eugene
PermalinkMar 13
This can happen when there's a local file with the same name as an imported module – Python sees the local file and thinks it's the module.
In my case, I had a file I created in the same folder called requests.py. So my code was actually importing that file and not the actual requests module you install with pip. Then I had another issue with a file I created called logging.py. I renamed both files and the issue was resolved.
1 question comment
Use comments to ask for clarification. Post a solution as an answer.
Umer Waqas - nextjs pythonPermalink
Jul 31
try to change your file name