473,378 Members | 1,434 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 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 2011

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 code which uses shelve to save instances of some...
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 stemmed from a class that raised an error inside...
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! ## Begin of test.py import shelve f =...
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: import shelve, anydbm
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 some advice. The closest one ended with a...
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 ('test') I assume this has to do with the db behind...
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 this problem on debian: #extract from my code...
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, I'm not sure what SomeError should be. I tried...
13
by: 7stud | last post by:
test1.py: -------------------- import shelve s = shelve.open("/Users/me/2testing/dir1/aaa.txt") s = "red" s.close() --------output:------ $ python test1.py
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.