[Ironpython-users] sitecustomize and compiled ironpython
Peter Schwalm
ps at peter-schwalm.de
Wed Jan 9 12:04:52 CET 2013
Hello,
I have a problem concerning the default encoding in ironpython console
programs. In german windows editions there is a difference between the
codepage in gui programs und console programs. Console programs use OEM
encoding.
In the ironpython environment there happen implicit conversions between
byte encoded files and unicode strings inside the program.
If I read textfiles containing german umlauts they are implicitly
converted using the default encoding, in console programs OEM. If the
text files are encoded using a different codepage (ANSI, cp1252), then
conversion errors will happen if the file contains umlauts.
Normally I solve this problem by changing the default encoding in
sitecustomize.py which is automatically called by site.py during program
initialization. Now I have detected, that this mechanism will not work
in ipy-compiled programs. It looks as if sitecustomize.py is not called
in this environment.
Does anybody have an idea how to achieve an equally general solution for
this problem? Is there perhaps a sort of stub-.py-file used by
pyc-compilation where I can place the necessary call to
sys.setdefaultencoding?
My ironpython version 2.7.1.
Thanks in advance
Peter Schwalm
More information about the Ironpython-users
mailing list