Random in python 2.5 not working?

I am trying to use the import random statement in python, but it doesn’t appear to have any methods in it to use.

Am I missing something?


You probably have a file named random.py or random.pyc in your working directory. That’s shadowing the built-in random module. You need to rename random.py to something like my_random.py and/or remove the random.pyc file.

To tell for sure what’s going on, do this:

>>> import random
>>> print random.__file__

That will show you exactly which file is being imported.