Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > global name not defined

Thread Tools

global name not defined

Posts: n/a
I added a function 'warn_Admin' and defined it just before another
function 'process_log'. 'process_log' calls this warn_Admin' function.
However, when it gets called i get the following error every time:
Traceback (most recent call last):
File "/usr/bin/", line 202, in ?
first_time, noemail, daemon)
File "/usr/lib/python2.3/site-packages/DenyHosts/", line
86, in __init__
File "/usr/lib/python2.3/site-packages/DenyHosts/", line 74,
in createDaemon
apply(func, args)
File "/usr/lib/python2.3/site-packages/DenyHosts/", line
137, in runDaemon
purge_time, purge_sleep_ratio)
File "/usr/lib/python2.3/site-packages/DenyHosts/", line
178, in daemonLoop
last_offset = self.process_log(logfile, last_offset)
File "/usr/lib/python2.3/site-packages/DenyHosts/", line
380, in process_log
[warn_Admin(ip) for ip in new_denied_hosts]
NameError: global name 'warn_Admin' is not defined
If I take the two functions out of their current environment and store
them in test file and run it, it doesn't complain. I'm new to python
so I'm guessing there is some weird scope rule I am missing. I did try
'self.warn_Admin(ip)' just to be safe but then I got a 'too many
arguments' error?

I'm lost


Reply With Quote
Posts: n/a
google groups told me it had a "server error" the first time i posted
this. Sorry for the dupe. Anyways the second one is more complete.
Also, I made a mistake in my vocabulary. These are methods and not

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
User-defined exception: "global name 'TestRunError' is not defined" Python 1 07-10-2008 12:37 PM
global name not defined NetKev Python 5 05-24-2006 03:34 AM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM
Re: global name not defined :$ Fredrik Lundh Python 0 06-20-2005 01:09 PM
global name "Result" is not defined Elmar Haneke Python 1 03-30-2005 01:31 PM