0

At the Python terminal, I can run:

import random
random.randint(1,6)

It gives a number, as expected. However, I save this script as random.py and it fails to run:

import random
print random.randint(1,3)

It says "AttributeError: 'module' object has no attribute 'randint'"

NoBugs
  • 9,310
  • 13
  • 80
  • 146

1 Answers1

2

Try saving your script as something other than random.py. It's probably importing itself. Delete the old copy of random.py in your CWD before trying again.

user1277476
  • 2,871
  • 12
  • 10