| 1 | initial version |
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?
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.