Microsoft
Software
Hardware
Network
Question : global name 'do_traceroute' is not defined?
I got the error message: "NameError: global name 'do_traceroute' is not defined". Can anyone help me find what is wrong with my python code below?
--------------------------
----------
----------
----------
----------
----------
----------
----------
----------
----------
----------
import thread
import os
class Connecter:
... ...
def do_traceroute():
os.system('traceroute
www.google.com'
)
... ...
def got_message(self, connection, message):
... ...
print 'Here is a test!'
thread.start_new(do_tracer
oute, ())
... ...
Answer : global name 'do_traceroute' is not defined?
Because
do_traceroute() is a method of your class, you need to say:
1: 2: 3:
def got_message(self, connection, message): ... thread.start_new(self.do_traceroute, ())
Open in New Window
Select All
Random Solutions
Excel - Copy all Tab data to one master tab automatically
How to append to an existing output file using BCP utility?
How to setup a squid proxy
Implementing Document Workflow in Sharepoint & InfoPath
Ghost won't let me create a new scheduled backup even though all backup jobs have been deleted.
recovery model in sql server 7
C++ deamon creation
OEM Job
Scan from brother MFC-8460N and email through Outlook 2003
Access 2007 bloat