[I18n-sig] codec questions

Tom Emerson tree@basistech.com
Sun, 30 Apr 2000 01:29:08 -0400 (EDT)


I'm using 1.6a2 and the following doesn't run. I must be doing
something brain-dead here (I'm jet lagged right now):

--
import codecs;

foo = codecs.open('Sc-orig.utf', 'rb', 'utf-8')

line = foo.readline()
while (line != ""):
    print line
    line = foo.readline()
foo.close()
--

When I attempt to run that, in the directory containing 'Sc-orig.utf',
I get:

(0) tree% python process.py
Traceback (most recent call last):
  File "process.py", line 5, in ?
    line = foo.readline()
  File "/opt/tree/lib/python1.6/codecs.py", line 318, in readline
    return self.reader.readline(size)
NameError: self

Any ideas? I'm trying to grok the architecture so I can add
transcoding support for TIS-620 (Thai, an 8-bit encoding which should
work fine with the mapping codecs), GB2312 (multibyte, simplified
Chinese), and Big-5 (multibyte, traditional Chinese). But I can't even
get the simplest code to work, so I need someone to hit me with a
stick.

Also, are transcoding tables loaded as needed? Or all at once? What
are the plans for managing transcoding tables?

Thanks.

        -tree

-- 
Tom Emerson                                          Basis Technology Corp.
Language Hacker                                    http://www.basistech.com
  "Beware the lollipop of mediocrity: lick it once and you suck forever"