Closed Bug 1315970 Opened 8 years ago Closed 8 years ago

Exception in .parse method reading file with incorrect encoding

Categories

(Localization Infrastructure and Tools :: compare-locales, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: flod, Assigned: Pike)

References

Details

Attachments

(2 files)

When running entities, map = file_parser.parse() On a file with wrong encoding, with 1.2 I get an exception, while 1.1 would simply log the error. Traceback (most recent call last): File "/Users/flodolo/github/tmx_maker/tests/test_string_extraction.py", line 181, in testBrokenEnconding extraction.extractStrings() File "/Users/flodolo/github/tmx_maker/tmx_products/tmx_products.py", line 139, in extractStrings entities, map = file_parser.parse() File "/Users/flodolo/github/tmx_maker/libraries/compare-locales/compare_locales/parser.py", line 224, in parse for e in self: File "/Users/flodolo/github/tmx_maker/libraries/compare-locales/compare_locales/parser.py", line 237, in walk contents = ctx.contents AttributeError: 'NoneType' object has no attribute 'contents' Attached is the file generating this error.
This is a regression from bug 1290883.
Assignee: nobody → l10n
Blocks: 1290883
Comment on attachment 8809037 [details] bug 1315970, failed loading should return empty parse lits, https://reviewboard.mozilla.org/r/91706/#review91594 Thanks, it makes sense and works as expected now.
Attachment #8809037 - Flags: review?(francesco.lodolo) → review+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Blocks: 1315976
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: