[Ironpython-users] sitecustomize and compiled ironpython
Jeff Hardy
jdhardy at gmail.com
Wed Jan 9 21:42:28 CET 2013
Are you using pyc to build an exe? If so, I don't think there is. Can
you not call sys.setdefaultencoding() at the start of your program,
from Python?
If not, you may need to look at the Python codecs library to manually
handle file encodings.
- Jeff
On Wed, Jan 9, 2013 at 3:04 AM, Peter Schwalm <ps at peter-schwalm.de> wrote:
> 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
>
>
> _______________________________________________
> Ironpython-users mailing list
> Ironpython-users at python.org
> http://mail.python.org/mailman/listinfo/ironpython-users
More information about the Ironpython-users
mailing list