Why does a shelf cause an error if I try to open a file created only by the shelf?
import shelve info_file_name = "/Users/bacon/myproject/temp/test.info" info_file = shelve.open(info_file_name) info_file['ok'] = 'wass' info_file.close() info_file = shelve.open(info_file_name)
I am running python 2.5 in case it is relevant
The exact mistake is to increase:
db type could not be determined , called by anydbm.py open method.
I know this using gdbm. I checked whatdb.py file and tried to identify gdbm files with this
# Read the start of the file -- the magic number s16 = f.read(16) s = s16[0:4] # Convert to 4-byte int in native byte order -- return "" if impossible (magic,) = struct.unpack("=l", s) # Check for GNU dbm if magic == 0x13579ace: return "gdbm"
But the number "magic" in my file is 324508367 ( 0x13579acf ) (only the last change in the number!)
I tried to open the file with a different language (ruby) and I was able to open it without any problems, so this seems to be an error in whodb.py trying to determine the correct dbm
source share