py2exe error

Haim Ashkenazi haim at babysnakes.org
Wed Jan 21 15:40:02 CET 2004


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