global name not defined

Discussion in 'Python' started by NetKev, May 23, 2006.

  1. NetKev

    NetKev Guest

    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/denyhosts.py", line 202, in ?
    first_time, noemail, daemon)
    File "/usr/lib/python2.3/site-packages/DenyHosts/deny_hosts.py", line
    86, in __init__
    last_offset)
    File "/usr/lib/python2.3/site-packages/DenyHosts/daemon.py", line 74,
    in createDaemon
    apply(func, args)
    File "/usr/lib/python2.3/site-packages/DenyHosts/deny_hosts.py", line
    137, in runDaemon
    purge_time, purge_sleep_ratio)
    File "/usr/lib/python2.3/site-packages/DenyHosts/deny_hosts.py", line
    178, in daemonLoop
    last_offset = self.process_log(logfile, last_offset)
    File "/usr/lib/python2.3/site-packages/DenyHosts/deny_hosts.py", 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 :)

    -kevin
     
    NetKev, May 23, 2006
    #1
    1. Advertising

  2. NetKev

    NetKev Guest

    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
    functions.
     
    NetKev, May 23, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Elmar Haneke

    global name "Result" is not defined

    Elmar Haneke, Mar 30, 2005, in forum: Python
    Replies:
    1
    Views:
    458
    Fredrik Lundh
    Mar 30, 2005
  2. Fredrik Lundh

    Re: global name not defined :$

    Fredrik Lundh, Jun 20, 2005, in forum: Python
    Replies:
    0
    Views:
    448
    Fredrik Lundh
    Jun 20, 2005
  3. NetKev

    global name not defined

    NetKev, May 22, 2006, in forum: Python
    Replies:
    5
    Views:
    621
    NetKev
    May 24, 2006
  4. Oodini
    Replies:
    1
    Views:
    1,842
    Keith Thompson
    Sep 27, 2005
  5. Replies:
    1
    Views:
    541
    Sion Arrowsmith
    Jul 10, 2008
Loading...

Share This Page