linode-cli
linode-cli copied to clipboard
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-97: character maps to <undefined>
Hi,
New to Linode here. Just trying to run the command linode-cli linodes list
and get this huge error.
Traceback (most recent call last):
File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\user\appdata\local\programs\python\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts\linode-cli.exe\__main__.py", line 9, in <module>
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\linodecli\__init__.py", line 424, in main
cli.handle_command(parsed.command, parsed.action, args)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\linodecli\cli.py", line 484, in handle_command
operation.process_response_json(result.json(), self.output_handler)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\linodecli\operation.py", line 185, in process_response_json
handler.print(self.response_model, json)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\linodecli\output.py", line 45, in print
self._table_output(header, data, columns, title, to)
File "c:\users\user\appdata\local\programs\python\python37\lib\site-packages\linodecli\output.py", line 100, in _table_output
print(tab.table, file=to)
File "c:\users\user\appdata\local\programs\python\python37\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-97: character maps to <undefined>
That's a new one. What version of the CLI are you running (linode-cli --version
)
linode-cli 2.10.3
Built off spec version 4.9.0
Running on Windows. Python 3.7.5
Thanks! Looking into this now
That error suggests that some character coming back is not encoding correctly in the "Windows-1252" character encoding. I assume this is related to a unicode character in one of your Linode labels. Ideally, the CLI would force encoding to unicode for all output to prevent these errors. I don't have ready access to a windows machine to reproduce this on, but I'll try to get a fix posted before tomorrow's scheduled CLI release.
Any news on this fix?
I haven't been able to reproduce this issue on my end but if you're still running into this issue, you may be able to resolve it using the PYTHONIOENCODING environment variable.
I'm going to close this issue for now, but feel free to @ me if it is still occurring.