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('te st.txt')
f['hello'] = 'world'
f.close()
f = shelve.open('te st.txt')
print f.keys()
print f.values()
# End of test.py
c:\Python>pytho n -V
Python 2.3.3
c:\Python>pytho n test.py
['hello']
['world']
c:\Python>pytho n 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\wi nexe\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\wi nexe\temp\datet ime.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.p y to _strptime.pyc
skipping byte-compilation of C:\Program
Files\Python23\ lib\sre_constan ts.py to sre_constants.p yc
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.p y 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.p y 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_threa d.py to dummy_thread.py c
skipping byte-compilation of C:\Program Files\Python23\ lib\opcode.py
to opcode.pyc
skipping byte-compilation of C:\Program
Files\Python23\ lib\posixpath.p y 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.p y 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.Attr ibuteError: "DbfilenameShel f instance has no
attribute 'writeback'" in ignored 0 2030 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 class I define. It
works perfectly on an old machine (PII-400) running Python 2.2.1 under
RedHat Linux 8.0. When I try to run it under Python for windows ME on a
P-4 1.4 GHz, however, it keeps crashing on reading from the shelved file
the second...
|
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
__init__and defined a __del__ method to clean up resources. I then
discovered asimilar problem in the shelve module. This led me to two
importantdiscoveries:
1. Attributes defined in __init__ after an error is raised will not be
apart of the...
|
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 = shelve.open('test.txt')
f = 'world'
f.close()
|
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
|
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 recommendation
to upgrade to Python 2.3, but that, unfortunately, is out of my
control. The system I use runs Python 2.2.2, and whichdb gives
dbhash.
The problem only occurs when serializing class instances; lists don't
seem to be affected. Every time...
| |
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 shelve.
|
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
import shelve
class XX:
def __init__(self):
self._data = shelve.open("/tmp/myfile")
|
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 error,
anydbm.error, shelve.open.anydb.error, etc. but can't find it. Things
|
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
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |