Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a Python GEDCOM parser: Receiving bad output (gedcom.Element instance at 0x00...)
    primarykey
    data
    text
    <p>I'm new to Python, and I can say off the bat my programming experience is nominal compared to many of you. Brace yourselves :) </p> <p>I have 2 files. A GEDCOM parser written in Python that I found from a user on this site (gedcom.py - <a href="http://ilab.cs.byu.edu/cs460/2006w/assignments/program1.html" rel="nofollow noreferrer">http://ilab.cs.byu.edu/cs460/2006w/assignments/program1.html</a>) and a simple GEDCOM file that I pulled from heiner-eichmann.de/gedcom/gedcom.htm. Guess who's having trouble putting 2 and 2 together? This guy... </p> <p>Here is a code snippet followed by what I've done thus far.</p> <pre><code>class Gedcom: """ Gedcom parser This parser is for the Gedcom 5.5 format. For documentation of this format, see http://homepages.rootsweb.com/~pmcbride/gedcom/55gctoc.htm This parser reads a GEDCOM file and parses it into a set of elements. These elements can be accessed via a list (the order of the list is the same as the order of the elements in the GEDCOM file), or a dictionary (the key to the dictionary is a unique identifier that one element can use to point to another element). """ def __init__(self,file): """ Initialize a Gedcom parser. You must supply a Gedcom file. """ self.__element_list = [] self.__element_dict = {} self.__element_top = Element(-1,"","TOP","",self.__element_dict) self.__current_level = -1 self.__current_element = self.__element_top self.__individuals = 0 self.__parse(file) def element_list(self): """ Return a list of all the elements in the Gedcom file. The elements are in the same order as they appeared in the file. """ return self.__element_list def element_dict(self): """ Return a dictionary of elements from the Gedcom file. Only elements identified by a pointer are listed in the dictionary. The key for the dictionary is the pointer. """ return self.__element_dict </code></pre> <p><em>my little script</em></p> <p>import gedcom<br> g = Gedcom('C:\tmp\test.ged') //I'm on Windows<br> print g.element_list() </p> <p>From here, I receive a bunch of output "gedcom.Element instance at 0x00..." </p> <p>I'm not sure why I'm receiving this output. I thought according to the element_list method a formatted list would be returned. I've Googled and search this site. The answer is probably staring me in the face but I was hoping someone could point out the obvious. </p> <p>Much Appreciated. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload