--
You received this message because you are subscribed to the Google Groups "pygr-dev" group.
To post to this group, send email to pygr...@googlegroups.com.
To unsubscribe from this group, send email to pygr-dev+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en.
The simplest fix is to install PyBSDDB (get it here:)
http://www.jcea.es/programacion/pybsddb.htm
Simply installing that should fix the problem: i.e. you should be able to import this in your Python interpreter via "import bsddb3", and the problem you described in your email message should go away. Pygr 0.8.2 automatically looks for bsddb3 and uses it if bsddb is missing / not working, so you do not need to rename bsddb3 as Namshin used to do...
-- Chris Lee
> My Mac does not have the Berkeley DB installed, and there doesn't seem to be any Berkeley DB build for the Mac.
> Besides, you need an account with Oracle to download the source code.
Since you raised this, I just tried downloading and building Berkeley DB on Mac OS 10.6 following these instructions, which seemed to work fine:
http://code.google.com/p/tonatiuh/wiki/InstallingBerkeleyDBForMac
(he provides a link for downloading Berkeley DB). The only annoyance I hit was that it's not obvious what rules Oracle enforces on your proposed password; it kept rejecting everything I tried. Finally I succeeded. The rule seems to be: at least one number, at least one capital letter, at least one lowercase letter, no non-alphanumeric characters, and at least 8 characters long. Also, your username has to be an email address, although they don't seem to do anything to verify it.
The build ran fine. I didn't try to actually install it, as it's my policy never to modify my Apple-supplied system files (i.e. I always install software to other locations, a la Fink).
Pygr relies on the Python standard module anydbm to return whatever dbm style hash module your install supports, including gdbm. (anydbm tries them in the order: dbhash, gdbm, dbm, dumbdbm). The Pygr error message above means that both iter(d) and d.firstkey() failed, i.e. the hash-dictionary object supports neither standard Python iteration nor gdbm's firstkey()/nextkey() iteration methods. The implication is that either
- anydbm is choosing something other than gdbm, even though you say you have gdbm.
- or somehow gdbm is misbehaving.
To figure out what's going on, try the following tests:
import anydbm
print anydbm._defaultmod
d = anydbm.open('test_anydbm.dbm', 'c')
it = iter(d)
it.next()
anydbm._defaultmod shows which hash module anydbm actually chose.
If the hash supports iteration, it.next() should simply raise StopIteration (because the hash is empty).
A gdbm hash will fail on iter(d) because it lacks standard iteration methods. In that case try the following:
k = d.firstkey()
print k
If gdbm is working normally, the value of k should be None (because the hash is empty).
Let me know what results you get.
-- Chris
--
-- Chris
you might also consider using screed, which stores sequences in a
sqlite database directly. See:
https://github.com/ctb/screed/blob/master/screed/tests/test_pygr_api.py
for an example of how to use it with pygr. Briefly,
from screed.pygr_api import ScreedSequenceDB
should give you a drop-in replacement for SequenceFileDB, although you'll
need to index the database separately; see
https://github.com/ctb/screed/blob/master/doc/example.txt
for information on how to do that.
cheers,
--titus