HELP:UnboundLocalError: local variable '_nntp' referenced before assignment

Peter Moscatt pgmoscatt at
Fri Mar 18 12:07:39 CET 2005

Hi all,

I am in the process of writing an app that will handle news feeds and
therefore using the 'nntplib'

When I issue the connect command all goes will but when I issue the 'quit()'
command I get the following error message:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.3/lib-tk/", line 1345, in __call__
    return self.func(*args)
  File "./", line 26, in callconnect
UnboundLocalError: local variable '_nntp' referenced before assignment

The code below illustrates how I'm using the code.  Can anyone help me out
in getting this right.


def callconnect():
        if b["text"]=="Connect":
                _nntp =
        elif b["text"]=="Disconnect":

More information about the Python-list mailing list