espressif/esp-idf-monitor

The python monitor issue in ESP-IDF version 5.1.2 (IDFGH-11774)

4444monkey opened this issue · 2 comments

Hi There,
As I try to export a CSV file using pyhton tools, I encountered following issuse. Would any one help provide any tip to solve that?
Currently, I'am using Vscode with ESP-IDF version 5.1.2 in Windows 11 and other functions remain good except for the python monitoring part.

File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\esp_idf_monitor\base\ansi_color_converter.py", line 72, in _output_write
self.output.write(data.decode()) # type: ignore
^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 0: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\ENG\esp\esp-idf\tools\idf.py", line 779, in
main()
File "C:\Users\ENG\esp\esp-idf\tools\idf.py", line 714, in main
cli(sys.argv[1:], prog_name=PROG, complete_var=SHELL_COMPLETE_VAR)
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\click\core.py", line 1691, in invoke
return _process_result(rv)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\click\core.py", line 1628, in _process_result
value = ctx.invoke(self._result_callback, value, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ENG\esp\esp-idf\tools\idf.py", line 611, in execute_tasks
task(ctx, global_args, task.action_args)
File "C:\Users\ENG\esp\esp-idf\tools\idf.py", line 193, in call
self.callback(self.name, context, global_args, **action_args)
File "C:\Users\ENG\esp\esp-idf\tools\idf_py_actions\serial_ext.py", line 167, in monitor
RunTool('idf_monitor', monitor_args, args.project_dir, build_dir=args.build_dir, hints=hints, interactive=True, convert_output=True)()
File "C:\Users\ENG\esp\esp-idf\tools\idf_py_actions\tools.py", line 304, in call
process, stderr_output_file, stdout_output_file = asyncio.run(self.run_command(self.args, env_copy))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "asyncio\runners.py", line 190, in run
File "asyncio\runners.py", line 118, in run
File "asyncio\base_events.py", line 653, in run_until_complete
File "C:\Users\ENG\esp\esp-idf\tools\idf_py_actions\tools.py", line 348, in run_command
await asyncio.gather(
File "C:\Users\ENG\esp\esp-idf\tools\idf_py_actions\tools.py", line 421, in read_and_write_stream
output_converter.write(output)
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\esp_idf_monitor\base\ansi_color_converter.py", line 131, in write
self._output_write(b)
File "C:\Users\ENG.espressif\python_env\idf5.1_py3.11_env\Lib\site-packages\esp_idf_monitor\base\ansi_color_converter.py", line 89, in _output_write
self.output.write(self.decode_buffer.decode(errors='replace')) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'cp950' codec can't encode character '\ufffd' in position 0: illegal multibyte sequence
Exception ignored in: <function BaseSubprocessTransport.del at 0x0000021C664A7600>
Traceback (most recent call last):
File "asyncio\base_subprocess.py", line 125, in del
File "asyncio\base_subprocess.py", line 78, in repr
File "asyncio\proactor_events.py", line 80, in repr
File "asyncio\windows_utils.py", line 102, in fileno
ValueError: I/O operation on closed pipe
Exception ignored in: <function _ProactorBasePipeTransport.del at 0x0000021C664CCD60>
Traceback (most recent call last):
File "asyncio\proactor_events.py", line 116, in del
File "asyncio\proactor_events.py", line 80, in repr
File "asyncio\windows_utils.py", line 102, in fileno
ValueError: I/O operation on closed pipe

@4444monkey How do you run into this issue? Judging from the export, you somehow process the output of idf.py. Please be more specific so we could reproduce the issue. esp-idf-monitor doesn't support any CSV export.

You are right, this query might related to another category. I'd put it into another discussion about the application of csi monitorhttps://github.com/espressif/esp-csi/issues/154. The issue was solved as well.