2to3 on Mac - unknown encoding: mbcs

Skip Montanaro skip at pobox.com
Fri Nov 6 02:50:57 CET 2009

I tried naively running 2to3 over the SpamBayes source code on my Mac
and got this traceback:

    Traceback (most recent call last):
      File "/Users/skip/local/lib/python3.2/lib2to3/pgen2/tokenize.py", line 281, in find_cookie
        codec = lookup(encoding)
    LookupError: unknown encoding: mbcs

SpamBayes does have several files which contain the "mbcs" coding


After a little hunting I came across the docs for the codecs module,
which for "mbcs" states:

    Windows only: Encode operand according to the ANSI codepage (CP_ACP)

Is there something I can use to replace the mbcs coding cookies which
will allow 2to3 to process these Windows-specific files?


Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/

More information about the Python-list mailing list