{"action":"created","issue":{"url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/212","repository_url":"https://api.github.com/repos/sciunto-org/python-bibtexparser","labels_url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/212/comments","events_url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/212/events","html_url":"https://github.com/sciunto-org/python-bibtexparser/issues/212","id":347818048,"node_id":"MDU6SXNzdWUzNDc4MTgwNDg=","number":212,"title":"Possible exceptions are not documented","user":{"login":"benureau","id":2088743,"node_id":"MDQ6VXNlcjIwODg3NDM=","avatar_url":"https://avatars3.githubusercontent.com/u/2088743?v=4","gravatar_id":"","url":"https://api.github.com/users/benureau","html_url":"https://github.com/benureau","followers_url":"https://api.github.com/users/benureau/followers","following_url":"https://api.github.com/users/benureau/following{/other_user}","gists_url":"https://api.github.com/users/benureau/gists{/gist_id}","starred_url":"https://api.github.com/users/benureau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benureau/subscriptions","organizations_url":"https://api.github.com/users/benureau/orgs","repos_url":"https://api.github.com/users/benureau/repos","events_url":"https://api.github.com/users/benureau/events{/privacy}","received_events_url":"https://api.github.com/users/benureau/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-06T07:59:24Z","updated_at":"2018-08-06T08:25:19Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"On a parsing problem, most of the time, the user will receive either a `pyparsing.ParseException` or a `pyparsing.ParseSyntaxException`. But when providing the empty string, an `IndexError` will be raised. This is not a problem per se, but currently, this is not documented, and must be discovered when problem happen."},"comment":{"url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/comments/410628600","html_url":"https://github.com/sciunto-org/python-bibtexparser/issues/212#issuecomment-410628600","issue_url":"https://api.github.com/repos/sciunto-org/python-bibtexparser/issues/212","id":410628600,"node_id":"MDEyOklzc3VlQ29tbWVudDQxMDYyODYwMA==","user":{"login":"benureau","id":2088743,"node_id":"MDQ6VXNlcjIwODg3NDM=","avatar_url":"https://avatars3.githubusercontent.com/u/2088743?v=4","gravatar_id":"","url":"https://api.github.com/users/benureau","html_url":"https://github.com/benureau","followers_url":"https://api.github.com/users/benureau/followers","following_url":"https://api.github.com/users/benureau/following{/other_user}","gists_url":"https://api.github.com/users/benureau/gists{/gist_id}","starred_url":"https://api.github.com/users/benureau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benureau/subscriptions","organizations_url":"https://api.github.com/users/benureau/orgs","repos_url":"https://api.github.com/users/benureau/repos","events_url":"https://api.github.com/users/benureau/events{/privacy}","received_events_url":"https://api.github.com/users/benureau/received_events","type":"User","site_admin":false},"created_at":"2018-08-06T08:25:19Z","updated_at":"2018-08-06T08:25:19Z","author_association":"CONTRIBUTOR","body":"And the following bibstring will throw a `bibtexparser.bibdatabase.UndefinedString`:\r\n```\r\n@misc{this looks,\r\n  like = a = bibtex file but\r\n    , is not a real one!\r\n```\r\n\r\n```python\r\nbibraw = '''@misc{this looks,\r\n  like = a = bibtex file but\r\n    , is not a real one!\r\n'''\r\n\r\nfrom bibtexparser.bparser import BibTexParser\r\n\r\nbtp = BibTexParser()\r\n\r\nprint(btp.parse(bibraw, partial=False).get_entry_dict())\r\n```\r\nproduces:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 102, in expand_string\r\n    self.strings[name])\r\nKeyError: 'a'\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n  File \"pubs/test.py\", line 23, in <module>\r\n    print(btp.parse(bibraw, partial=False).get_entry_dict())\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bparser.py\", line 147, in parse\r\n    self._expr.parseFile(bibtex_file_obj)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibtexexpression.py\", line 263, in parseFile\r\n    return self.main_expression.parseFile(file_obj, parseAll=True)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 2163, in parseFile\r\n    return self.parseString(file_contents, parseAll)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1622, in parseString\r\n    loc, tokens = self._parse( instring, 0 )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3919, in parseImpl\r\n    return super(ZeroOrMore, self).parseImpl(instring, loc, doActions)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3848, in parseImpl\r\n    loc, tokens = self_expr_parse( instring, loc, doActions, callPreParse=False )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3530, in parseImpl\r\n    ret = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3395, in parseImpl\r\n    loc, exprtokens = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3530, in parseImpl\r\n    ret = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3395, in parseImpl\r\n    loc, exprtokens = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3378, in parseImpl\r\n    loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3717, in parseImpl\r\n    return self.expr._parse( instring, loc, doActions, callPreParse=False )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3395, in parseImpl\r\n    loc, exprtokens = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1379, in _parseNoCache\r\n    loc,tokens = self.parseImpl( instring, preloc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 3530, in parseImpl\r\n    ret = e._parse( instring, loc, doActions )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1405, in _parseNoCache\r\n    tokens = fn( instring, tokensStart, retTokens )\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/pyparsing.py\", line 1049, in wrapper\r\n    ret = func(*args[limit[0]:])\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibtexexpression.py\", line 260, in _string_expr_parse_action\r\n    return self._string_expr_parse_action_fun(s, l, t)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bparser.py\", line 184, in <lambda>\r\n    BibDataStringExpression.expression_if_needed(t)))\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bparser.py\", line 178, in <lambda>\r\n    maybe_interpolate = lambda expr: as_text(expr)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 223, in as_text\r\n    return text_string_or_expression.get_value()\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 184, in get_value\r\n    return ''.join([BibDataString.expand_string(s) for s in self.expr])\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 184, in <listcomp>\r\n    return ''.join([BibDataString.expand_string(s) for s in self.expr])\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 150, in expand_string\r\n    return string_or_bibdatastring.get_value()\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 131, in get_value\r\n    return self._bibdatabase.expand_string(self.name)\r\n  File \"/Users/fcyb/.venvs/pubs37/lib/python3.7/site-packages/bibtexparser/bibdatabase.py\", line 104, in expand_string\r\n    raise(UndefinedString(name))\r\nbibtexparser.bibdatabase.UndefinedString: 'a'\r\n```"}}
{"actor":{"display_login":"benureau"}}