[Spambayes] Question (or possibly a bug report)

Tim Peters tim.one at comcast.net
Mon Jul 21 15:33:51 EDT 2003


[Magnus Akselvoll]
> Hi. I'll try to make this short and technical. (And yes, I have read
> the manual and troubleshooting)
>
> System description:
> -------------------
> Windows XP Professional, Service Pack 1
> Office XP Service Pack 2, Exchange Server 2000
> SpamBayes Outlook Addin (beta), Binary version 0.4 (July 2003)

Mark (Hammond), does that ship with some subset of Python 2.3?

> Logged in as domain user with local administrative rights
>
> Problems:
> ---------
> 1. SpamBayes refuses to save some settings when restarting outlook.
> The "Enable Filtering" checkbox is always unchecked, and the
> "Possible Spam" filter is reset to "Untouched".
>
> 2. An attempt to manually start filter hangs. The progressbar does
> not start and the stop filtering button does not react. Outlook.exe
> process has to be killed.
>
> Logfiles:
> ---------
> 4 last logfiles attached. Seems to be some com/integration error.

No, it's worse than that <wink>.  All the log tracebacks end with the same
thing:

> ...
>   File "out1.pyz/tempfile", line 408, in NamedTemporaryFile
>   File "out1.pyz/tempfile", line 210, in _mkstemp_inner
>   File "out1.pyz/tempfile", line 42, in _set_cloexec
> exceptions.AttributeError: 'module' object has no attribute 'fcntl'

(BTW, I hate these abbreviated tracebacks.)

The problem is that, for some reason I don't know, tempfile is using a Unix
version of the _set_cloexec function.  This must come from Python 2.3, since
Python's tempfile module didn't have any such function before 2.3.

The only way I know for sure this can happen is if the environment variable

    PYTHONCASEOK

is set on your box (the value it's set to doesn't matter, it's just whether
that envar exists).  If that envar is set, then tempfile.py won't experience
the ImportError it *expects* to get on Windows when executing this block:

try:
    import fcntl as _fcntl
    def _set_cloexec(fd):
        flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
        if flags >= 0:
            # flags read successfully, modify
            flags |= _fcntl.FD_CLOEXEC
            _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
except (ImportError, AttributeError):
    def _set_cloexec(fd):
        pass

So if you have an envar named PYTHONCASEOK, get rid of it.  If you don't
have such an envar, I don't know what the problem could be.




More information about the Spambayes mailing list