[BUG]
alan-wischmeyer-climate opened this issue · 2 comments
TypeError: unhashable type: 'list' - python-BaseException
When trying to run the sample, Example 1: True color (PNG) on a specific date, from https://sentinelhub-py.readthedocs.io/en/latest/examples/process_request.html#Credentials. I get a TypeError: unhashable type: 'list' - python-BaseException
To Reproduce
Steps to reproduce the behavior:
evalscript = """
//VERSION=3
function setup() {
return {
input: [{
bands: ["B02", "B03", "B04"]
}],
output: {
bands: 3
}
};
}
function evaluatePixel(sample) {
return [sample.B04, sample.B03, sample.B02];
}
"""
request = SentinelHubRequest(
evalscript=evalscript,
input_data=[
SentinelHubRequest.input_data(
data_collection=DataCollection.SENTINEL2_L1C,
time_interval=("2023-05-20", "2023-05-21"),
)
],
responses=[SentinelHubRequest.output_response("default", MimeType.PNG)],
bbox=bbox,
size=bbox_size,
config=config,
)
image = request.get_data()
Expected behavior
Image data is returned in image
Environment
Python 3.11.3
requirements.txt
geojson
sentinelhub
Package Version
aenum 3.1.12
certifi 2023.5.7
charset-normalizer 3.1.0
click 8.1.3
dataclasses-json 0.5.7
geojson 3.0.1
idna 3.4
marshmallow 3.19.0
marshmallow-enum 1.5.1
mypy-extensions 1.0.0
numpy 1.24.3
oauthlib 3.2.2
packaging 23.1
Pillow 9.5.0
pip 23.1.2
pyproj 3.5.0
python-dateutil 2.8.2
requests 2.31.0
requests-oauthlib 1.3.1
sentinelhub 3.9.1
setuptools 65.5.0
shapely 2.0.1
six 1.16.0
tifffile 2023.4.12
tomli 2.0.1
tomli_w 1.0.0
tqdm 4.65.0
typing_extensions 4.6.2
typing-inspect 0.9.0
urllib3 2.0.2
utm 0.7.0
Stack trace or screenshots
{"features": [{"geometry": {"coordinates": [[[-87.640901, 40.716688], [-87.631245, 40.716688], [-87.631245, 40.723876], [-87.640901, 40.723876], [-87.640901, 40.716688]]], "type": "Polygon"}, "properties": {}, "type": "Feature"}], "type": "FeatureCollection"}
Image shape at 10 m resolution: (82, 79) pixels
Traceback (most recent call last):
File "/Users/alan/support-scripts/scripts/sentinel.py", line 95, in
sys.exit(main())
^^^^^^
File "/Users/alan/support-scripts/scripts/sentinel.py", line 89, in main
image = request.get_data()
^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/base.py", line 109, in get_data
return self._execute_data_download(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/base.py", line 183, in _execute_data_download
data_list = client.download(
^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 62, in download
return super().download(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/client.py", line 101, in download
results[future_order[future]] = future.result()
^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/client.py", line 117, in _single_download_decoded
response = self._single_download(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/client.py", line 130, in _single_download
response = self._execute_download(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/handlers.py", line 64, in new_download_func
return download_func(self, request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/handlers.py", line 37, in new_download_func
return download_func(self, request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 82, in _execute_download
response = self._do_download(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 115, in _do_download
headers=self._prepare_headers(request),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 126, in _prepare_headers
session_headers = self._execute_thread_safe(self._get_session_headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 104, in _execute_thread_safe
return thread_unsafe_function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 136, in _get_session_headers
return self.get_session().session_headers
^^^^^^^^^^^^^^^^^^
File "/Users/alan/support-scripts/.venv/lib/python3.11/site-packages/sentinelhub/download/sentinelhub_client.py", line 147, in get_session
if cache_key in SentinelHubDownloadClient._CACHED_SESSIONS:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unhashable type: 'list'
Process finished with exit code 1
Desktop
- OS: MacOS 13.4 (22F66)
Additional context
- None
Hi @alan-wischmeyer-climate
According to your stacktrace (i am very thankful you provided it), the issue seems to be that here the cache_key
is a list. The line above says it was created from the self.config
, and if we look at the method for cache_key creation it is created from config.sh_client_id
and config.sh_base_url
.
Please confirm that both these parameters are strings in your case (best to do it in python by creating your configuration object and checking the values). If not, we will investigate further.
That solved my issue. Thank you.