py2exe error

Haim Ashkenazi haim at babysnakes.org
Wed Jan 21 10:39:37 EST 2004


Pieter Claerhout wrote:

> Change the setup script to:
> 
> from distutils.core import setup
> import py2exe
> 
> setup(
>       options = {  'py2exe': { 'packages': 'encodings' } },
>       name = 'default',
>       version = '0.1.0',
>       console = ["CLI_Backup.py"],
>       windows = ["Configurator.py"]
> )
> 
> This will force py2exe to include the encodings package which should solve
> your problem
thanx, it solved the problem.

Bye

> 
> Cheers,
> 
> 
> pieter
> 
> Creo
> pieter claerhout | product support prinergy | tel: +32 2 352 2511 |
> pieter.claerhout at creo.com | www.creo.com
> 
> IMAGINE CREATE BELIEVE(tm)
> 
> 
> -----Original Message-----
> From: Haim Ashkenazi [mailto:haim at babysnakes.org]
> Sent: 21 January 2004 15:40
> To: python-list at python.org
> Subject: py2exe error
> 
> 
> Hi
> 
> (complete newbie warning...:) )
> 
> I've written a script that uses pickle to store data to a file. here's the
> code that stored the data:
> 
> -------------
> 
>     def put(self, conf):
>         """ dump the preferences to a file"""
>         
>         # TODO: make a backup copy of the prefs !!!!
>         try:
>             f = open(self.bacFile, "w")
>         except:
>             raise 'BadFileError', "couldn't write file"
>             
>         pickle.dump(conf, f)
>         f.close()
> 
> ---------------------------------
> 
> when running from regular python interperter, it works fine.
> 
> I need this script to run without python installed, so I've created a
> stand-alone binary with py2exe. I used the following simple setup.py:
> 
> from distutils.core import setup
> import py2exe
> 
> setup(name = 'default',
>       version = '0.1.0',
>       console = ["CLI_Backup.py"],
>       windows = ["Configurator.py"]
> )
> -------------------------
> 
> when running from this binary I get this error:
> Traceback (most recent call last):
>   File "MainFrame.pyc", line 140, in OnSaveMenuEvent
>   File "MainFrame.pyc", line 174, in dumpPrefs
>   File "NS_Backup.pyc", line 64, in put
>   File "pickle.pyc", line 1382, in dump
>   File "pickle.pyc", line 231, in dump
>   File "pickle.pyc", line 293, in save
>   File "pickle.pyc", line 663, in save_dict
>   File "pickle.pyc", line 677, in _batch_setitems
>   File "pickle.pyc", line 293, in save
>   File "pickle.pyc", line 514, in save_unicode
> LookupError: no codec search functions registered: can't find encoding
> -----------------------------
> 
> I guess I should add some custom module to the setup.py but I don't know
> which (or am I completely off track here...).
> 
> can someone help?
> 
> thanx
> --
> Haim
> 
> 
> 






More information about the Python-list mailing list