473,409 Members | 1,942 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,409 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 2014

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
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.