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
Desktop Shortcut to URL does not open IE
How to remove a child domain
Users can't access e-mail, but domain admins can
How to write a dynamic page that updates itself without reloading the page?
Updating the System DSN In ODBC and Default Database Setting Won't Save Selection
Opening a new window with window.showModalDialog
Looking for a utility that will monitor mailbox access and notify whenever it is accessed
Vista says "The requested operation requires elevation" - but this is not true!
how to change the IP address of Linux box in network
Excel VBA Error - "ODBC driver does not support the requested properties."