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
Can you validate email addresses without SENDING it to the address? We want to confirm before sending bulk marketing emails. Some will be old and outdated.
Installing a root certificate on cell phone for EAS
vcdmf.exe - what is it?
MSSQL Reporting Services - Filtering data in a table
How to Encrypt FullText Search Column Value using MS SQL Server 2005?
.mdb vs .adp front end with SQL server backend
trouble sending email to particular domains
Server 2008 IIS redirects http access to <a rel="nofollow" href="http://localhost/" target="_blank">http://localhost/</a><sitename<wbr />>
Delegate authority to unlock workstation
How to force a batch Script to start only after the fisrt one is finished.