[Spambayes] Configuration error

Skip Montanaro skip.montanaro at gmail.com
Thu Feb 19 19:15:56 CET 2015


On Thu, Feb 19, 2015 at 10:22 AM, Robert T. Roither <septet at verizon.net>
wrote:

>  I get the following error messages when I click the save button on the
> configuration page (http://localhost:8880/config) :
>
> *...*
>


>
> *UnboundLocalError: local variable 'state' referenced before assignment*
> I'm running up to date XP home with outlook express.
>
> Any suggestions?
>
> Looking at the code, I can see how that would be a problem. Not sure why
it would be turning up now. That function needs a "global state" statement.
If you have easy access to the code, you can replace the definition of the
_recreateState function with this (singla change is in bold):

def _recreateState():
    # Close the existing listeners and create new ones.  This won't
    # affect any running proxies - once a listener has created a proxy,
    # that proxy is then independent of it.
    # (but won't closing the database screw them?)
    *global state*

    for proxy in proxyListeners:
        proxy.close()
    del proxyListeners[:]

    if state.prepared:
        # Close the state (which saves if necessary)
        state.close()
    # And get a new one going.
    state = State()

    prepare()
    _createProxies(state.servers, state.proxyPorts)
    return state

Let me know how it goes. I have no way to generate a new installer, but
will try to remember to check in the fix in case someone in the distant
future ever decides to work on SpamBayes again.

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/spambayes/attachments/20150219/cbc50312/attachment.html>


More information about the SpamBayes mailing list