error when importing JSONDecodeError from requests.exceptions
orbitfold opened this issue · 1 comments
orbitfold commented
Describe the bug
When importing s2cloudless I get an error that seems to have to do with this issue:
https://www.peterbe.com/plog/jsondecodeerror-in-requests.get.json-python-2-and-3
It should be possible to fix this by changing line 16 in sentinelhub/download/session.py to the following:
import requests
try:
from simplejson.errors import JSONDecodeError
except ImportError:
from json.decoder import JSONDecodeError
I can make a pull request if you want.
To Reproduce
>>> import s2cloudless
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.8/dist-packages/s2cloudless/__init__.py", line 7, in <module>
from .sentinelhub_masking import CloudMaskRequest, NoDataAvailableException
File "/usr/local/lib/python3.8/dist-packages/s2cloudless/sentinelhub_masking.py", line 8, in <module>
from sentinelhub import (
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/__init__.py", line 6, in <module>
from .api import (
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/api/__init__.py", line 4, in <module>
from .batch import (
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/api/batch/__init__.py", line 4, in <module>
from .base import BatchRequestStatus, BatchUserAction
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/api/batch/base.py", line 10, in <module>
from ..base import SentinelHubService
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/api/base.py", line 15, in <module>
from ..base import FeatureIterator
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/base.py", line 10, in <module>
from .download import DownloadClient, DownloadRequest
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/download/__init__.py", line 7, in <module>
from .sentinelhub_client import SentinelHubDownloadClient
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/download/sentinelhub_client.py", line 21, in <module>
from .session import SentinelHubSession
File "/usr/local/lib/python3.8/dist-packages/sentinelhub/download/session.py", line 16, in <module>
from requests.exceptions import JSONDecodeError
ImportError: cannot import name 'JSONDecodeError' from 'requests.exceptions' (/dss/dsshome1/lrz/sys/spack/release/22.2.1/opt/x86_64/py-requests/2.25.1-gcc-725jaez/lib/python3.8/site-packages/requests/exceptions.py)
>>>