[Bug 271116] net-im/py-matrix-synapse 1.82.0 should probably require devel/py-simplejson

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 09 May 2023 20:01:55 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=271116

--- Comment #2 from Li-Wen Hsu <lwhsu@FreeBSD.org> ---
The full Traceback:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/synapse/app/homeserver.py", line
37, in <module>
    from synapse.app import _base
  File "/usr/local/lib/python3.9/site-packages/synapse/app/_base.py", line 75,
in <module>
    from synapse.module_api.callbacks.spamchecker_callbacks import
load_legacy_spam_checkers
  File "/usr/local/lib/python3.9/site-packages/synapse/module_api/__init__.py",
line 73, in <module>
    from synapse.http.client import SimpleHttpClient
  File "/usr/local/lib/python3.9/site-packages/synapse/http/client.py", line
32, in <module>
    import treq
  File "/usr/local/lib/python3.9/site-packages/treq/__init__.py", line 5, in
<module>
    from treq.api import head, get, post, put, patch, delete, request
  File "/usr/local/lib/python3.9/site-packages/treq/api.py", line 5, in
<module>
    from treq.client import HTTPClient
  File "/usr/local/lib/python3.9/site-packages/treq/client.py", line 37, in
<module>
    from treq.response import _Response
  File "/usr/local/lib/python3.9/site-packages/treq/response.py", line 7, in
<module>
    from requests.cookies import cookiejar_from_dict
  File "/usr/local/lib/python3.9/site-packages/requests/__init__.py", line 45,
in <module>
    from .exceptions import RequestsDependencyWarning
  File "/usr/local/lib/python3.9/site-packages/requests/exceptions.py", line 9,
in <module>
    from .compat import JSONDecodeError as CompatJSONDecodeError
  File "/usr/local/lib/python3.9/site-packages/requests/compat.py", line 40, in
<module>
    from simplejson import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError' from 'simplejson' (unknown
location)
/usr/local/etc/rc.d/synapse: WARNING: failed to start synapse


However, in /usr/local/lib/python3.9/site-packages/requests/compat.py

    30  # json/simplejson module import resolution
    31  has_simplejson = False
    32  try:
    33      import simplejson as json
    34  
    35      has_simplejson = True
    36  except ImportError:
    37      import json
    38  
    39  if has_simplejson:
    40      from simplejson import JSONDecodeError
    41  else:
    42      from json import JSONDecodeError

It should work even simplejson does not exist.

-- 
You are receiving this mail because:
You are on the CC list for the bug.