简体   繁体   中英

How to test this GEDCOM parser?

I was trying to test this parser with my gedcom file. I do not understand how to call some of the functions and what parameters are to be given. Example, in the families function, I need to pass an individual as the parameter but if I type a Person's full name or even his ID it does not accept. I get an error "AttributeError: 'str' object has no attribute 'is_individual'".

https://github.com/madprime/python-gedcom

I appreciate the help. Thank you!

Re your specific example: In the gedcom/__init__.py file, the is_individual method is only defined for the Element class, so presumably the families method is assuming that (the value bound to) its individual parameter is an instance of that class. In your case, this would be one of the many Element instances created when the parser parses your gedcom file, which you can get at via the element_list or element_dict methods of the Gedcom class.

Note: In the repo you link to, the README says that the project has moved elsewhere . You should probably use the parser there. Moreover, if you raise an issue there, they might expand the documentation to answer your questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM