Exception: AttributeError: module 'random' has no attribute
- A common mistake. Using the wrong filename.
This works fine:
examples/my/random.py
print("Hello World")
This gives an error
examples/my/rnd.py
import random print(random.random())
Traceback (most recent call last): File "rnd.py", line 2, in <module> print(random.random()) AttributeError: module 'random' has no attribute 'random'
Make sure the names of your files are not the same as the names of any of the python packages.