It kind of looks like Durus is coded to be able to initialize zero-
length db files but I'm having trouble with it. This is useful as I
need to do some batch operations with Durus and the more secure
methods of managing temp files (tempfile.NamedTemporaryFile) involve
handing zero-length temp files to Durus. Durus is throwing an
exception in this case. Might this be a bug or is it just something
not supported by Durus? I'm using Durus 3.4.1.
------
$ ls -al
total 0
drwxr-xr-x 2 me me 68 Jul 1 09:25 .
drwxr-xr-x 59 me me 2006 Jul 1 09:25 ..
$ durus -c --file=test.durus
Durus test.durus
connection -> the connection
root -> get(0)
get(oid) -> get an object
pp(object) -> pretty-print
>>>
$ ls -al
total 8
drwxr-xr-x 3 me me 102 Jul 1 09:25 .
drwxr-xr-x 60 me me 2040 Jul 1 09:25 ..
-rw-r--r-- 1 me me 125 Jul 1 09:25 test.durus
$ rm test.durus
$ touch test.durus
$ durus -c --file=test.durus
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/Current/bin/
durus", line 22, in ?
client_main()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/durus/client.py", line 108, in client_main
options.startup)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/durus/client.py", line 34, in interactive_client
storage = FileStorage(file, readonly=readonly, repair=repair)
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/durus/file_storage.py", line 93, in __init__
self._set_concrete_class_for_magic()
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/durus/file_storage.py", line 119, in
_set_concrete_class_for_magic
self._write_index(self.fp, {})
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/
python2.4/site-packages/durus/file_storage.py", line 475, in
_write_index
assert fp.tell() == len(self.MAGIC) + 8
AssertionError
$
------
Thanks.
Dave
------
David K. Hess
Verscend Technologies, Inc.
dhess@verscend.com
214-684-5448