You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When infrahubctl reads a file that is not using UTF-8 encoding you get the following error message.
Error: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte
Traceback (most recent call last):
File "/private/tmp/testing/.venv/lib/python3.9/site-packages/infrahub_sdk/ctl/utils.py", line 79, in async_wrapper
return await func(*args, **kwargs)
File "/private/tmp/testing/.venv/lib/python3.9/site-packages/infrahub_sdk/ctl/schema.py", line 156, in load
schemas_data = load_schemas_from_disk_and_exit(schemas=schemas)
File "/private/tmp/testing/.venv/lib/python3.9/site-packages/infrahub_sdk/ctl/schema.py", line 55, in
load_schemas_from_disk_and_exit
schemas_data = load_schemas_from_disk(schemas=schemas)
File "/private/tmp/testing/.venv/lib/python3.9/site-packages/infrahub_sdk/ctl/schema.py", line 38, in
load_schemas_from_disk
schema_file.load_content()
File "/private/tmp/testing/.venv/lib/python3.9/site-packages/infrahub_sdk/yaml.py", line 17, in load_content
self.content = yaml.safe_load(self.location.read_text())
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line
1257, in read_text
return f.read()
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/codecs.py", line
322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfe in position 0: invalid start byte
This happens when you try to load a schema file or when reading an infrahubctl configuration file.
Expected Behavior
We should display a proper error message that explains that the file we are reading is not encoded using UTF-8 and the location/path of the file that we are trying to read.
Steps to Reproduce
Create the following schema file, and save it using UTF-16 encoding.
Component
Python SDK, infrahubctl
Infrahub SDK version
0.14.1
Current Behavior
When infrahubctl reads a file that is not using UTF-8 encoding you get the following error message.
This happens when you try to load a schema file or when reading an infrahubctl configuration file.
Expected Behavior
We should display a proper error message that explains that the file we are reading is not encoded using UTF-8 and the location/path of the file that we are trying to read.
Steps to Reproduce
iconv -f UTF-8 -t UTF-16 schema.yml > schema_new.yml
to convert the encoding of the file.\Additional Information
No response
The text was updated successfully, but these errors were encountered: