Resolving issue308, getting a warning message if the 'parse' method i…
Fixes https://github.com/sciunto-org/python-bibtexparser/issues/308. A warning message will appear if the parse method is called more than once and the message will be "Parser has been called more than once."
Excuse my late reply.
On some files, you changed the indentation of the lines, which makes this PR a bit verbose. Would you mind reverting these?
Sorry about that, I just fixed the indentation as it was before.
FYI: I do not dislike the changed indentations, but the PR should be self-contained and only consist of the changes relevant to the new feature (the warning), to keep the commit history as legible as possible.
I understand, you are right, it's now much cleaner and less verbose, I had to use diff from the beginning, I double-checked them using git diff master issue308 file_name.py and I think that's ok, but if you see any other errors I can fix it.
Thanks :-)
We're almost done. Unfortunately, I had previously not noticed that the warning provides relatively little information. In my review, I suggested a slightly different warning. Feel free to change my suggestion, however :-)
Afterward, if nothing else pops up, we should be ready to merge 🎉
the warning provides relatively little information. In my review, I suggested a slightly different warning.
If I'm not mistaken you want Traceback to provide more information correct?
Is it ok with you?
Traceback (most recent call last):
File "/testing/reproduce_issue247.py", line 15, in <module>
b_database = bibtexparser.load(fileb, parser)
File "/python-bibtexparser/venv/lib/python3.10/site-packages/bibtexparser-1.3.0-py3.10.egg/bibtexparser/__init__.py", line 69, in load
File "/python-bibtexparser/venv/lib/python3.10/site-packages/bibtexparser-1.3.0-py3.10.egg/bibtexparser/bparser.py", line 181, in parse_file
File "/python-bibtexparser/venv/lib/python3.10/site-packages/bibtexparser-1.3.0-py3.10.egg/bibtexparser/bparser.py", line 154, in parse
UserWarning: Parser has been called more than once, avoid the warning by setting property expect_multiple_parse to True.
If I'm not mistaken you want
Tracebackto provide more information correct?
No, this is not what I meant ;-)
What I meant was that the current message in the warning "Parser has been called more than once, avoid the warning by setting property expect_multiple_parse to True." does not really give the user a good idea about why this may be a problem.
I am thus suggesting to use the following instead:
Parser has been called more than once. Subsequent parse call lead to a combined BibTeX library. To avoid the warning, set property
parser.expect_multiple_parsetoTrue.
You should see a "suggestion" in my review, on which - if you agree and don't spot any typos - can just click "commit suggestion" (or something alike):

How can I revert the last commit because I added a suggestion?
Hi @mrn97
I am not sure why you'd want to revert a commit? I have still added some missing documentation - not this PR looks good to me, and is ready to be merged. Any objections?
@mrn97 is there anything you want to add to this? otherwise I'm gonna merge this soon
This is now merged. Thanks @mrn97 for your contribution
Excuse my late reply. @MiWeiss Thank you for giving me the opportunity to contribute and for your help.