Ask Your Question

Revision history [back]

Here is a way to generate the same error message:

>>> import random
>>> random()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable

The function random from the module of the same name is callable:

>>> from random import random
>>> random()
0.6012904467670809

Therefore, I would suggest to add the line

from random import random

to your code to make sure that random is really a function and not a module. Does this fix your problem?