Hi Kenny, you need to close() the Mapping when you're done writing data to it. Its file-based storage uses Python shelve, which I believe may not write its data to disk until you close() it. Mapping tries to call close() for you automatically when garbage-collected (i.e. Mapping.__del__ calls self.close()), but as you have just experienced, that is unpredictable and unreliable (i.e. there's no sure way to know exactly when Python will garbage-collect your object after you drop all references to it).
Note: I think you should Graph (one-to-many or many-to-many) instead of Mapping (one-to-one). See the tutorial examples or mapping module docs, and ask if you have questions... -- Chris On Jun 13, 2009, at 3:52 PM, Kenny Daily wrote: > > So, I've gotten the mapping to work, but only sometimes? > > The code is here (http://kmdaily.pastebin.com/m6d4a86c3) that I'm > running. > > I'm checking the length of the Mapping when I'm done loading all the > things to map (its ~9000), adding it to worldbase, and checking the > length again (still 9000). Then, the code exits, and I try to load it > on the command line or use it again, and it has a 0 length. I look at > the file that its writing to, and I can see the data in it (the keys > and values of the objects from the AnnotationDBs that I added). The > object loads fine, and it accesses the database backend fine as well > (watching the db connections shows it connecting). Any suggestions how > to track the problem? Thanks! > > Kenny --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to pygr-dev@googlegroups.com To unsubscribe from this group, send email to pygr-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---