[Pythonmac-SIG] codecs

Just van Rossum just at letterror.com
Tue Sep 9 15:44:43 EDT 2003


Yannis Haralambous wrote:

> when I do:
> 
> >unicode("a","utf8")
> 
> I get:
> 
> >Traceback (most recent call last):
> >  File "<stdin>", line 1, in ?
> >LookupError: no codec search functions registered: can't find
encoding
> 
> even after an "import encodings", and an "import codecs"

Something's not right with your install.

> I'm using:
> >Python 2.3 (#1, Sep  8 2003, 10:13:34) 
> >[GCC 3.1 20020420 (prerelease)] on darwin
> under MacOS X 10.2.6
> 
> I checked and there is indeed a codecs.py in /sw/lib/python2.3 and an
> encodings directory  /sw/lib/python2.3/encodings/
> 
> is this a bug in the python distribution for Darwin? Or am I doing
> something wrong?

I think the problem may also occur of you have a _different_ module
named "encodings" on sys.path. You can check by importting "encodings"
and checking its __file__. Or on the interactive prompt, it should show
something like this:

  >>> import encodings
  >>> encodings
  <module 'encodings' from '/usr/lib/python2.2/encodings/__init__.pyc'>
  >>> 

Just



More information about the Pythonmac-SIG mailing list