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
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.
On running print(random): builtins.NameError: name 'random' is not defined
My Python configuration: Executable: C:\Users\galib20\AppData\Local\Programs\Python\Python37-32\python.exe.
Python path: as above.
On running print(random) builtins.NameError: name 'random' is not defined
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.
To enter a block of code:
Comments