shelve crashing under Win ME



Hi,

I'm not a Win ME fan myself (I'm a Mac user), but I'm here in Thailand
developing software for special-needs kids, and the test PC in my home
office is a Win ME machine (sigh). So when I ported my Python program
today to the PC, it quickly crashed. Everything seems to work except
for shelve. Using the latest version of Python (2.5.1), when I do the
following in IDLE on the Win ME machine here's the result:

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC
v.1310 32 bit (Intel)] on win32
IDLE 1.2.1
import shelve
f=shelve.open("foo")

Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
f=shelve.open("foo")
File "C:\PYTHON25\lib\shelve.py", line 225, in open
return DbfilenameShelf(filename, flag, protocol,
writeback)
File "C:\PYTHON25\lib\shelve.py", line 209, in
__init__
Shelf.__init__(self, anydbm.open(filename, flag),
protocol, writeback)
File "C:\PYTHON25\lib\anydbm.py", line 83, in open
return mod.open(file, flag, mode)
File "C:\PYTHON25\lib\dbhash.py", line 16, in open
return bsddb.hashopen(file, flag, mode)
File "C:\PYTHON25\lib\bsddb\__init__.py", line 306,
in hashopen
d.open(file, db.DB_HASH, flags, mode)
DBError: (5, 'Input/output error')


For those who know shelve, this should actually run fine (if the file
"foo" does not exist it should create it). Printing the value of "f"
should show an empty dictionary {}.

It does run fine on my iBook (under Python 2.4.4) and on my iBook's
Virtual PC running Win XP & Python 2.5.0. I do not think this is a
Python 2.5.1 problem, because my first attempt to run my program on
the Win ME machine was with a version of the program I ported using
Py2exe on the VPC under Python 2.5.0, and it crashed the same way when
run on the Win ME machine (I subsequently installed Python on the Win
ME PC to try to get to the root of the problem.)

Help! How do I get Win ME (or at least the misbehaving Win ME machine
in my office) to run shelve? (or more specifically run bsddb's
hashopen?)

Or should I trash shelve entirely and rewrite all my code to use a
simpler, homemade database scheme?

Thanks for any advice!

Warmly,
Joel
joelgluck@xxxxxxxxx

.



Relevant Pages

  • Re: shelve error
    ... Neither the book I am reading, "Beginning Python: ... shelve supplies a function open that is polymorphic to anydbm.open. ... the defaulf value for argument flag is 'c' (meaning, ... and opens an existing file, ...
    (comp.lang.python)
  • Re: shelve crashing under Win ME
    ... Python, when I do the following in IDLE ... in open return DbfilenameShelf(filename, flag, ... For those who know shelve, ... Py2exe on the VPC under Python 2.5.0, ...
    (comp.lang.python)
  • Re: shelve crashing under Win ME
    ... when I ported my Python program today to the ... anydbm.open(filename, flag), protocol, ... For those who know shelve, ... ported using Py2exe on the VPC under Python ...
    (comp.lang.python)
  • Re: missing xor Boolean operator
    ... unless you are very aware of all python boolean mechanisms. ... it works, you will make mistakes. ... Given three result codes, where 0 means "no error" and an arbitrary non- ... like (flag + flag) is meaningful. ...
    (comp.lang.python)
  • Re: what happens when the file begin read is too big for all lines to be read with "readlines()"
    ... > Let me introduce my problem I came across last night first. ... # we expect Python to close the file when we exit the loop ... Here is another solution, without using a flag: ... def get_line: ...
    (comp.lang.python)