Under certain conditions, python tries to read /raw_data/currencies.json as ascii instead of utf-8 and it cannot read the file. See the stacktrace below.
Traceback (most recent call last):
File "/corp/views/current/project/business/display.py", line 160, in get_currency_symbol
currency_symbol = cc.get_symbol("USD")
File "/corp/virtualenvs/corpweb/lib/python3.8/site-packages/forex_python/converter.py", line 140, in get_symbol
currency_dict = self._get_data(currency_code)
File "/corp/virtualenvs/corpweb/lib/python3.8/site-packages/forex_python/converter.py", line 132, in _get_data
currency_dict = next((item for item in self._currency_data if item["cc"] == currency_code), None)
File "/corp/virtualenvs/corpweb/lib/python3.8/site-packages/forex_python/converter.py", line 128, in _currency_data
self.__currency_data = json.loads(f.read())
File "/usr/lib64/python3.8/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7400: ordinal not in range(128)
2022-05-26 00:35:53,423 ERROR display(165): get_currency_symbol: Could not decode currency_code: USD
Under certain conditions, python tries to read
/raw_data/currencies.json
asascii
instead ofutf-8
and it cannot read the file. See the stacktrace below.