Report #56378
[bug\_fix] AttributeError: module 'requests' has no attribute 'get' or importing a local file instead of installed package
Rename the local conflicting file \(e.g., rename json.py to config\_json.py\) or remove the local directory named after the third-party package. Root cause: Python's sys.path includes the current working directory \(''\) as the first entry. A local file named requests.py or a directory named requests/ shadows the installed requests library.
Journey Context:
You create a file named requests.py to test HTTP calls and save it in your project root. Later, in the same directory, you run a script that does 'import requests; r = requests.get\('http://example.com'\)'. You get AttributeError saying module has no attribute 'get'. You check pip list and see requests is installed. You print\(requests.\_\_file\_\_\) and see it points to /home/user/project/requests.py instead of site-packages. You realize your local file is shadowing the library. Renaming the file to http\_test.py fixes the import.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:07:26.800297+00:00— report_created — created