Open
Description
At present, if a bib entry is repeated, the whole process will exit with no attempt to continue/skip over/ remedy the situation meaning one has to then go hunting manually.
This can be replicated with:
python3 fixbibtex.py examples/duplicates.bib # or mixedduplicates.bib which contains more than 1 simple repetition
(Examples are in my fork of the repo and PR to come).
Invoking the script gives the user the following traceback:
Traceback (most recent call last):
File "fixbibtex.py", line 250, in <module>
cli()
File "fixbibtex.py", line 246, in cli
main(args.path)
File "fixbibtex.py", line 229, in main
newbib = loop.run_until_complete(fix_bibtex(path))
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete
return future.result()
File "fixbibtex.py", line 99, in fix_bibtex
bib = parse_bibfile(path)
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/__init__.py", line 852, in parse_file
return parser.parse_file(file)
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/input/__init__.py", line 51, in parse_file
self.parse_stream(f)
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/input/bibtex.py", line 385, in parse_stream
return self.parse_string(text)
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/input/bibtex.py", line 380, in parse_string
self.process_entry(entry_type, *entry[1])
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/input/bibtex.py", line 347, in process_entry
self.data.add_entry(key, entry)
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/database/__init__.py", line 150, in add_entry
report_error(BibliographyDataError('repeated bibliograhpy entry: %s' % key))
File "/Users/joehealey/Applications/miniconda3/lib/python3.6/site-packages/pybtex/errors.py", line 77, in report_error
raise exception
pybtex.database.BibliographyDataError: repeated bibliograhpy entry: Hitchcock1986
Since duplicated entries aren't strictly an issue for use with TeX (a warning is usually given, but I believe compilation will continue without error, and duplicates are skipped). It would be good if the script could gracefully handle this scenario, even if the solution is just to skip the entry, and warn, as TeX does.
Metadata
Metadata
Assignees
Labels
No labels