[spambayes-dev] RE: [Spambayes-checkins] spambayes/spambayes storage.py, 1.31, 1.32

Tony Meyer ta-meyer at ihug.co.nz
Thu Sep 11 13:12:50 EDT 2003


> Modified Files:
> 	storage.py 
> Log Message:
> Bug 803501: Fix the "No dbm modules available" message to 
> print rather than crash.

"""
!             print >> sys.stderr, "You do not have a dbm module available "
\
                    "to use.  You need to either use a pickle (see the FAQ)"
\
                    ", use Python 2.3 (or above), or install a dbm module "
\
                    "such as bsddb (see http://sf.net/projects/pybsddb)."
-             import sys
"""

I'm willing to believe that this fixes the problem, but I don't see how this
works, and in the interests of bettering my Python understanding, could
someone explain it?

sys is imported at the top of storage.py, so I see that the "import sys" is
no longer necessary.  What I don't get is how there could be this error:

"""
File "/Users/chris/Desktop/spambayes-1.0a5/spambayes/storage.py", line 652,
in open_storage

    print >> sys.stderr, """\

UnboundLocalError: local variable 'sys' referenced before Assignment
"""

when sys has been imported.  Especially since the change is removing a line
*after* the crash.  What am I missing?

=Tony Meyer




More information about the spambayes-dev mailing list