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
Migration of PKI infrastructure to a non-PKI infrastructure
Animated horizontal pop-out menu or Slide-out menu...
Word Outline Numbering Style Failing to Use Parent Style
How much to charge - Experts only please
User not receiving all Exchange mail in Outlook 2007
NEC VERSA M300 notebook is acting different after bios update
MS Server 2003 R2 Standard x64 Blue Screen Shutdown every Saturday
Row Number
Overriding the max 3 Conditional Formating in Access
Event ID 4321 and 8003