texworld / betterbib

:green_book: Command-line tools for bibliographies.
816 stars 42 forks source link

Make checking openretractions optional/have an "offline" mode? #262

Closed Liam-Twomey closed 1 year ago

Liam-Twomey commented 1 year ago

When I try to process my bibfile, I get:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 169, in _new_conn
    conn = connection.create_connection(
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

This is then attributed to:

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='openretractions.com', port=80): Max retries exceeded with url: /api/doi/10.1007/bf02787851/data.json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7ff14a2113c0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

When I ping openretractions.com it is also registers "Name or service not known", I think their website is down.

Request: Can checking crossref and openretractions be made a CLI option, please? I just don't need them for my usecase (although they are lovely options), and it'd be great to use betterbib without them, especially since I see that the unreliability of the openretractions API has been noted in other issues.

nschloe commented 1 year ago

This has been fixed in the latest release. Note that 5.0 is the first commercial release of betterbib.

chenyubi14 commented 1 year ago

Thanks for working out a new release, but it still does not work for me. I tried betterbib -h and I got the following error.

Traceback (most recent call last):
  File "/Users/yubichen/opt/miniconda3/bin/betterbib", line 5, in <module>
    from betterbib._cli import main
  File "/Users/yubichen/opt/miniconda3/lib/python3.9/site-packages/betterbib/__init__.py", line 3, in <module>
    from ._agg import _jhVT8 as adapt_doi_urls, _vZdfk as Crossref, _2TiRn as Dblp, _WIRCb as journal_abbrev, _VqwpK as check_retractions, _IxYE8 as sync, _y1IK1 as bibtex_to_unicode, _x1hQn as convert_entry_to_latex, _LXqY6 as dict_to_string, _r22JZ as doi_from_url, _H94ty as get_short_doi, _6wcyn as merge, _M7lXN as pybtex_to_bibtex_string, _6eng0 as pybtex_to_dict, _VU0P6 as translate_month, _wqeDp as translate_title
  File "/Users/yubichen/opt/miniconda3/lib/python3.9/site-packages/betterbib/_agg/__init__.py", line 2, in <module>
    x21.dex_23c(__file__)
  File "<string>", line 877, in <module>
  File "<string>", line 4, in wrapper
  File "<string>", line 161, in __load__
  File "<string>", line 4, in wrapper
  File "<string>", line 157, in _aUZfM
  File "/Users/yubichen/opt/miniconda3/lib/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
  File "/Users/yubichen/opt/miniconda3/lib/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/yubichen/opt/miniconda3/lib/python3.9/site-packages/betterbib/_agg/data/capit.json'
nschloe commented 1 year ago

Thanks @chenyubi14 for the report! I've just released 5.0.1, fixing the issue.