again py2exe and codecs

A

Achim Domma

Hi,

I still have problems to get cjkcodecs to work with py2exe. I added
cjkcodecs to my setup.py like this:

opts = {
"py2exe" : {
"includes" : ["encodings","encodings.*","cjkcodecs","cjkcodecs.*"],
"packages" : ["encodings","cjkcodecs"]
}
}

After that, my distribution contains _gb2312.pyd and _big5.pyd but at
runtime I get an unknown encoding error, if I try to use gb2312 or big5. Any
hint?

regards,
Achim
 
T

Thomas Heller

Achim Domma said:
Hi,

I still have problems to get cjkcodecs to work with py2exe. I added
cjkcodecs to my setup.py like this:

opts = {
"py2exe" : {
"includes" : ["encodings","encodings.*","cjkcodecs","cjkcodecs.*"],
"packages" : ["encodings","cjkcodecs"]
}
}

After that, my distribution contains _gb2312.pyd and _big5.pyd but at
runtime I get an unknown encoding error, if I try to use gb2312 or big5. Any
hint?

cjkcodecs installs a cjkcodecs.pth file which includes this signle line:

import cjkcodecs.aliases

This import seems to register the cjk codecs - import lines in pth files
are executed (in site.py).

py2exe doesn't pick up any pth file, nor does it execute things in them.
So, you have to insert the 'import cjkcodecs.aliases' line in your
script, and you should be able to build it with this:

opts = {
"py2exe" : {
"packages" : ["encodings","cjkcodecs"]
}
}

If this works for you, feel free to write something up for the wiki ;-)

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,184
Messages
2,570,973
Members
47,529
Latest member
JaclynShum

Latest Threads

Top