Trouble writing custom text codec

Jurie Horneman jhorneman at pobox.com
Thu Feb 28 05:28:07 EST 2002


Why does my custom text codec, which I have based on an existing,
working codec as recommended by the documentation, work with
codecs.open() but not with MyString.decode(), where as the built-in
codecs do?

I've stopped simply calling the decode() method; I'm down to calling
getdecoder() and executing that now. I keep getting "TypeError:
unbound method decode() must be called with Codec instance as first
argument (got class instance instead)" and I have no clue how to get
rid of these. Actually creating instances of the right class and
passing that to the decoding function as the first argument do not
help at all - and how come a) the built-in codecs do not have this
problem and b) codecs.open() works with my codec?

The more I look into it, the more incomprehensible I find the whole
codec system.

Jurie Horneman (very, very frustrated)



More information about the Python-list mailing list