3

I have a script to create a book from the database of Gramps. After an update to Gramps 4.1 (I have now 4.2.1), the place have a hierarchical place structure. How can I retrieve the birth place now with python 3?

My legacy code was:

            birth = self.database.get_event_from_handle(birth_ref.ref)
            place_handle = birth.get_place_handle()
  • I'm voting to close this question as off-topic because it's asking about coding not family history or genealogy. Might be better placed on StackOverflow? – user104 Dec 26 '15 at 14:33
  • 5
    This is coding, but Gramps is one of the most popular open source genealogy programs, and Python is easy to learn. – Doug Blank Dec 26 '15 at 16:17
  • 1
    Just because something is easy to learn doesn''t make it on-topic here. I could reach you to boil an egg in a few minutes but we wouldn't let you ask for cookery instructions here. @DougBlank – user104 Dec 27 '15 at 8:38
  • 4
    My point in ease of coding was that editing code in Gramps is about as complicated as editing a configuration file in any genealogy program. And it might make a nice example (as this short two-line code demonstrates) for people to learn that they can easily write scripts to manage their genealogical data. – Doug Blank Dec 27 '15 at 13:03
4

You can look up a place, given a place handle:

place = db.get_place_from_handle(place_handle)
print(place.name.value)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.