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
MS Server 2003 R2 Standard x64 Blue Screen Shutdown every Saturday
Illustrator: Inset Emboss
User not receiving all Exchange mail in Outlook 2007
How much to charge - Experts only please
Word Outline Numbering Style Failing to Use Parent Style
Animated horizontal pop-out menu or Slide-out menu...
Unable to uninstall a program
DBase IV and Unexpected Error
fetchrow_array() no print
EPSON LQ-300 II