Python error "Python NameError: global name 'Thread' is not defined"

0 votes

I have a file with python code called thread.py. I get the following error when i try to execute it:

Python NameError: global name 'Thread' is not defined

When I change the name to anything else like example1.py, it works perfectly fine. What is the problem?

May 31 in Python by Ishaan
97 views

1 answer to this question.

0 votes
There is a built-in function with the name thread and hence you cannot that as a filename. Change the filename to anything else and it should work.
answered May 31 by Riya

Related Questions In Python

0 votes
1 answer

Python Error saying "NameError: global name 'true' is not defined"

It's a very small mistake. Change true ...READ MORE

answered Jun 17 in Python by Vinayak
111 views
0 votes
2 answers
0 votes
0 answers

Python error saying "NameError: name 'email' is not defined"

I get the following error while executing ...READ MORE

Jun 13 in Python by Kamal

edited Jun 13 75 views
0 votes
0 answers

what is a name error in python?

why am i getting a name error ...READ MORE

Mar 7 in Python by anonymous
138 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 175 views
+4 votes
6 answers
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

answered Nov 28, 2018 in Python by Omkar
• 67,290 points
1,172 views
0 votes
1 answer

Python error "'Series' object is not callable "

Try this: df['ln_returns'] = np.log(df['Close_mid']/df['Close_mid']) df['Close_mid'](1)) doesn't seem to ...READ MORE

answered Jul 22 in Python by Greg
82 views