From: David F. <da...@sj...> - 2004-06-15 11:54:09
|
R.R...@ve... wrote: >Hello > >if have a function which converts uft-16 to latin-1 > > >import codecs > >def Uni2Latin(datei): > try: > inFile = codecs.open(datei, 'r', encoding="utf-16") > outFile = codecs.open(datei+'.txt', 'w', encoding="Latin-1") > lines = inFile.readlines() > outFile.writelines(lines) > inFile.close() > outFile.close() > return True > except: > return False > >This works fine, but if I use this func. in a program made by py2exe this functions is not able to open a utf-16 files. > >Any advice would be appreciated > >Thanks > >richard rossbach > > Try and include "encodings" in the list of packages you give to py2exe (-p encodings on the command line or in the options dictionary). Then it should work David |