py2exe with shelve error

ex laguna ed_zeng at yahoo.com
Sat Jan 24 00:06:45 CET 2004


Hi, I have ran into a problem with py2exe 0.5.0 and shelve in python
2.3.3.  The script works fine standalone, but not with py2exe.

Does anyone have a solution of workaround for this?  Thanks much.

# Begin of setup.py
from distutils.core import setup
import py2exe

setup(console=["test.py"])
# End of setup.py

# Begin of test.py
import shelve

f = shelve.open('test.txt')
f['hello'] = 'world'
f.close()
f = shelve.open('test.txt')
print f.keys()
print f.values()
# End of test.py

c:\Python>python -V
Python 2.3.3

c:\Python>python test.py
['hello']
['world']

c:\Python>python setup.py py2exe
running py2exe
*** searching for required modules ***
*** parsing results ***
creating python loader for extension '_sre'
creating python loader for extension 'datetime'
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
skipping byte-compilation of C:\Program
Files\Python23\lib\__future__.py to __future__.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\copy_reg.py
to copy_reg.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\sre_compile.py to sre_compile.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\locale.py
to locale.pyc
byte-compiling c:\Python\build\bdist.win32\winexe\temp\_sre.py to
_sre.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\unittest.py
to unittest.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\macpath.py
to macpath.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\popen2.py
to popen2.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\stat.py to
stat.pyc
byte-compiling c:\Python\build\bdist.win32\winexe\temp\datetime.py to
datetime.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\atexit.py
to atexit.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\whichdb.py
to whichdb.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\cmd.py to
cmd.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\os2emxpath.py to os2emxpath.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\tempfile.py
to tempfile.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\pprint.py
to pprint.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\_strptime.py to _strptime.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\sre_constants.py to sre_constants.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\re.py to
re.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\ntpath.py
to ntpath.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\tokenize.py
to tokenize.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\getopt.py
to getopt.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\doctest.py
to doctest.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\random.py
to random.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\string.py
to string.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\warnings.py
to warnings.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\UserDict.py
to UserDict.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\inspect.py
to inspect.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\repr.py to
repr.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\traceback.py to traceback.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\copy.py to
copy.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\bdb.py to
bdb.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\types.py to
types.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\anydbm.py
to anydbm.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\sre.py to
sre.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\pickle.py
to pickle.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\StringIO.py
to StringIO.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\pdb.py to
pdb.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\linecache.py to linecache.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\token.py to
token.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\dummy_thread.py to dummy_thread.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\opcode.py
to opcode.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\posixpath.py to posixpath.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\calendar.py
to calendar.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\shelve.py
to shelve.pyc
skipping byte-compilation of C:\Program
Files\Python23\lib\sre_parse.py to sre_parse.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\os.py to
os.pyc
skipping byte-compilation of C:\Program Files\Python23\lib\dis.py to
dis.pyc
*** copy extensions ***
*** copy dlls ***
copying C:\Program Files\Python23\Lib\site-packages\py2exe\run.exe ->
c:\Python\dist\test.exe

c:\Python>cd dist

c:\Python\dist>test.exe
Traceback (most recent call last):
  File "test.py", line 3, in ?
  File "shelve.pyc", line 231, in open
  File "shelve.pyc", line 211, in __init__
  File "anydbm.pyc", line 62, in ?
ImportError: no dbm clone found; tried ['dbhash', 'gdbm', 'dbm',
'dumbdbm']
Exception exceptions.AttributeError: "DbfilenameShelf instance has no
attribute 'writeback'" in  ignored



More information about the Python-list mailing list