Reputation: 347
I am getting this error pop up when I try to run the code below:
Error:
Traceback (most recent call last):
File "C:/Users/benja/PycharmProjects/Project12/random.py", line 2, in
<module>
import random
File "C:\Users\benja\PycharmProjects\Project12\random.py", line 8, in
<module>
random.random()
TypeError: 'module' object is not callable
Code:
import random
uF=[]
for i in range(1, 10):
for x in range(1):
random.random()
print(uF)
I've tried reinstalling pycharm and python but it still doesn't seem to want to work even though it was working only a week ago.
Upvotes: 0
Views: 488
Reputation: 191738
You need to rename your file away from random.py
as to not collide with the inbuilt random module.
I'm guessing a few weeks ago your file was not named this way.
Upvotes: 5