Common causes
- A typo in the attribute name — attribute names are case-sensitive
- The function was moved to a different submodule in a newer package version
- You imported the module under a different name than expected
- Your file has the same name as the module you're importing, shadowing the real module
How to fix it
- Check the module's documentation or use dir(module) to see what's available
- Verify the spelling and case: urllib.parse not urllib.Parse
- Check if the function moved to a submodule: from module.sub import func
- Make sure your script file isn't named the same as the module you're importing (e.g. don't name your file random.py)
Example
Traceback (most recent call last):
File "app.py", line 2, in <module>
os.makedirs_exist_ok('/tmp/test')
AttributeError: module 'os' has no attribute 'makedirs_exist_ok'Calling a misremembered function name — the correct call is os.makedirs('/tmp/test', exist_ok=True)
Have a different error?
Paste any error message into the Error Translator to get an instant explanation.
