1

While trying to use thread in Python , with the following code

import select, sys, time, thread

TIMEOUT = 30

def listenthread(server,result):

# some code 
#
#

def main(argv=None):
    if argv is None:
        argv = sys.argv[1:]
    server = Server()            
    clientaddrs = []
    # listen to clients in new thread
    thread.start_new_thread(listenthread, (server,clientaddrs)) # that line produces a problem

I get Undefined variable from import: start_new_thread when I reach the line :

 thread.start_new_thread(listenthread, (server,clientaddrs))

What might be the problem ?

Regards

Nikolai Fetissov
  • 82,306
  • 11
  • 110
  • 171
JAN
  • 21,236
  • 66
  • 181
  • 318

1 Answers1

2

This is a common PyDev bug. I see nothing wrong with your code, PyDev is simply alerting you to a non-existent error.

See the answers listed here and here.

Community
  • 1
  • 1
radicalbiscuit
  • 487
  • 1
  • 6
  • 18