472,345 Members | 1,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,345 software developers and data experts.

py2exe with shelve error

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.p y 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
Jul 18 '05 #1
0 1910

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Rami A. Kishek | last post by:
Hi - this mysterious behavior with shelve is just about to kill me. I hope someone here can shed some light. First of all, I have this piece of...
0
by: seth | last post by:
Last week I encountered an AttributeError in my unit tests that I wasn'table to catch with an "except AttributeError" statement. The problem...
0
by: ex laguna | last post by:
I have run into this problem below with py2exe version 0.5.0 and python 2.3.3. Does anyone know a solution or workaround for this? Thanks much! ...
0
by: Michael Mulcahy | last post by:
Hi All, Problem: Shelve module doesn't like me OS: Win2000 version: 2.3.3 Here is simple reproduction code and the error that occurs: ...
0
by: Ray O | last post by:
I have read a number of threads relating to problems with shelve, but I couldn't find one directly related my experience, so I would appreciate...
5
by: Philippe C. Martin | last post by:
Hi, I just installed (compiled) Python 2.4.2 under Suse 10. The following code generates a seg error: import shelve print shelve.open...
3
by: Michele Petrazzo | last post by:
Hi, I'm trying a script on a debian 3.1 that has problems on shelve library. The same script work well on a fedora 2 and I don't know why it create...
6
by: aomighty | last post by:
I wanted to write the following code: import shelve try: db = shelve.open(file, "r") except SomeError: print "Oh no, db not found" Only,...
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ ...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.