Ask Your Question

Python path

asked 2019-06-17 00:16:33 -0600

galib20's avatar

updated 2019-06-17 08:35:09 -0600

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-06-17 04:01:56 -0600

Do you have a file named 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.

edit flag offensive delete link more


On running print(random): builtins.NameError: name 'random' is not defined

galib20's avatar galib20  ( 2019-06-17 20:12:27 -0600 )edit

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

galib20's avatar galib20  ( 2019-06-17 20:15:22 -0600 )edit

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.

Wingware Support's avatar Wingware Support  ( 2019-06-17 20:22:19 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-06-17 00:16:33 -0600

Seen: 1,616 times

Last updated: Jun 17 '19