Differences between revisions 1 and 22 (spanning 21 versions)
Revision 1 as of 2003-11-26 18:11:10
Size: 150
Editor: 193
Comment:
Revision 22 as of 2008-07-08 11:27:44
Size: 2509
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
In py2exe 0.5, if the encodings are not found in the built exe, add these two to the ''includes'':
{{{'encodings', 'encodings.*'}}}
== Solution 1 ==

In py2exe 0.5, if the encodings are not found in the built exe (indicated by {{{LookupError: no codec search functions registered}}} error message), add these two to the ''includes'':
{{{
#!python
'encodings', 'encodings.*'
}}}

You can do this by adding a line
{{{
#!python
options = {"py2exe": {"packages": ["encodings"]}},
}}}
to your setup.py file.

That replaces the {{{'--force-imports encodings'}}} command line option from the [[http://starship.python.net/crew/theller/py2exe/|0.4py2exe]]


== Solution 2 ==

Adding {{{'encodings', 'encodings.*'}}} to includes includes ALL encodings. I'm perfectly happy with only having latin-1 present (at least for some application, which will only be used in western europe)

so recommended adding {{{
#!python
'encodings', 'encodings.latin_1'
}}}

20041201HAM

== Sample ==
To avoid misunderstandings here is a sample setup.py
{{{
#!python
from distutils.core import setup
import py2exe
      
setup(console=["MyScript.py"],
      options = {"py2exe": {"packages": ["encodings"]}},
)
}}}
(which by the way is roughly the same as {{{setup.py py2exe --packages encodings}}}.)


== changed behaviour ==

just "to be sure" I included "encodings" within options and again within the setup-command:

{{{
#!python
includes = ["encodings",
            "encodings.latin_1",]
[...]
options = {"py2exe": { # create a compressed zip archive
                      "compressed": 1,
                      "optimize": 2,
                      "excludes": excludes,
                      "includes": includes,
                          }}
[...]

setup(
    options = options,
    # The lib directory contains everything except the executables and the python dll.
    zipfile = zipfile,
    windows = [wxprog],
    console=[consprog],
    # use out build_installer class as extended py2exe build command
    cmdclass = {"py2exe": build_installer},
    packages = ["encodings"], #this line is rather wrong, at least not helpfull
    data_files=[("",["kategorien.xml","skm.cmd"]),
    ]
    )
}}}

py2exe 0.5.0 silently ignored the line
{{{
#!python
    packages = ["encodings"], #this line is rather wrong, at least not helpfull
}}}

py2exe 0.5.2 now uses this line for something and fails with:

{{{
running py2exe
running build_py
error: package directory 'encodings' does not exist
}}}

so: just trash that line and everything is sunny again. HAM20040713

Encoding

Solution 1

In py2exe 0.5, if the encodings are not found in the built exe (indicated by LookupError: no codec search functions registered error message), add these two to the includes:

   1 'encodings', 'encodings.*'

You can do this by adding a line

   1 options = {"py2exe": {"packages": ["encodings"]}},

to your setup.py file.

That replaces the '--force-imports encodings' command line option from the 0.4py2exe

Solution 2

Adding 'encodings', 'encodings.*' to includes includes ALL encodings. I'm perfectly happy with only having latin-1 present (at least for some application, which will only be used in western europe)

so recommended adding

   1 'encodings', 'encodings.latin_1'

20041201HAM

Sample

To avoid misunderstandings here is a sample setup.py

   1 from distutils.core import setup
   2 import py2exe
   3       
   4 setup(console=["MyScript.py"],
   5       options = {"py2exe": {"packages": ["encodings"]}},
   6 )

(which by the way is roughly the same as setup.py py2exe --packages encodings.)

changed behaviour

just "to be sure" I included "encodings" within options and again within the setup-command:

   1 includes = ["encodings",
   2             "encodings.latin_1",]
   3 [...]
   4 options = {"py2exe": { # create a compressed zip archive
   5                       "compressed": 1,
   6                       "optimize": 2,
   7                       "excludes": excludes,
   8                       "includes": includes,
   9                           }}
  10 [...]
  11 
  12 setup(
  13     options = options,
  14     # The lib directory contains everything except the executables and the python dll.
  15     zipfile = zipfile,
  16     windows = [wxprog],
  17     console=[consprog],
  18     # use out build_installer class as extended py2exe build command
  19     cmdclass = {"py2exe": build_installer},
  20     packages = ["encodings"], #this line is rather wrong, at least not helpfull
  21     data_files=[("",["kategorien.xml","skm.cmd"]),
  22     ]
  23     )

py2exe 0.5.0 silently ignored the line

   1     packages = ["encodings"], #this line is rather wrong, at least not helpfull

py2exe 0.5.2 now uses this line for something and fails with:

running py2exe
running build_py
error: package directory 'encodings' does not exist

so: just trash that line and everything is sunny again. HAM20040713

EncodingsAgain (last edited 2008-07-08 11:27:44 by localhost)