Python path
Hello everyone, What directory to be used as Python Path in Python configuration option? I am also getting this error: builtins.ImportError: cannot import name 'randint' from 'random'
Many Thanks, Galib
First time here? Check out the FAQ!
Hello everyone, What directory to be used as Python Path in Python configuration option? I am also getting this error: builtins.ImportError: cannot import name 'randint' from 'random'
Many Thanks, Galib
Do you have a file named random.py? I suspect that you're importing that file instead of random from the standard library. You can use print(random) to see the file used. In general, directories that your code is in should be added to the python path.
print(random) won't work unless you do 'import random'. I think you have 'from random import randint' or something like that so the symbol 'random' is not being defined by the import statement. But if you add 'import random' temporarily then you can use the print to see what is being imported.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2019-06-17 00:16:33 -0600
Seen: 1,616 times
Last updated: Jun 17 '19