TOPetit / pygedcom

MIT License
1 stars 1 forks source link

Parser fails, verification returns no result #1

Open scottb5612 opened 1 month ago

scottb5612 commented 1 month ago

I have a valid ged file However, it stats reveals nothing

{'head': 'None', 'submitters': 0, 'individuals': 0, 'families': 0, 'sources': 0, 'objects': 0, 'notes': 0, 'repositories': 0}

Verification also fails

verif = parser.verify() Traceback (most recent call last): File "", line 1, in File "/Users/baden/.venv/3_env/lib/python3.12/site-packages/pygedcom/gedcom_parser.py", line 70, in verify file = self.open() ^^^^^^^^^^^^^ File "/Users/baden/.venv/3_env/lib/python3.12/site-packages/pygedcom/gedcom_parser.py", line 46, in open data = file.read() ^^^^^^^^^^^ File "", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte

TOPetit commented 3 weeks ago

I added support for multiple encodings : ["utf-8", "utf-16", "latin1", "ansi"]. Let me know if version v0.2.3 this fixed your issue, if not please provide a minimal example causing the issue. commit

scottb5612 commented 3 weeks ago

It still fails, minimal example attached, along with my test program motivated by your README.md I had to renmae the test programs suffix, in order to be able to attach it Rename gedcom.py.txt getcom.py.txt test.txt to gedcom.py and run in the directory where test.txt is located.

Traceback (most recent call last): File "/Users/baden/PycharmProjects/Utils/gedcom.py", line 6, in check = parser.verify() ^^^^^^^^^^^^^^^ File "/Users/baden/.venv/3_env/lib/python3.12/site-packages/pygedcom/gedcom_parser.py", line 85, in verify parsed_line = self.__parse_line(line) ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/baden/.venv/3_env/lib/python3.12/site-packages/pygedcom/gedcom_parser.py", line 65, in __parse_line level = int(chars.pop(0)) ^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: '\ufeff0'