Pypemicro needs to gracefully handle situations where it's run on a system for which it does not have a valid library. Or at least raise a distinct PEMicroUnsupportedArchitecture
exception so that pyocd-pemicro can catch and gracefully handle it.
0000177:DEBUG:pemicro:There is no PEMICRO library.
0000177:CRITICAL:__main__:PEMicro Exception with error code:PEMicro Exception with error code:PEMicro Exception with error code:Unable to find any usable library in the system!
Traceback (most recent call last):
File "/Users/creed/projects/pyocd/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 411, in get_pemicro_lib
filename = PyPemicro.get_newest_lib_filename(libs_list)
File "/Users/creed/projects/pyocd/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 389, in get_newest_lib_filename
raise PEMicroException("Unable to find any usable library in the system!")
pypemicro.pemicro.PEMicroException: PEMicro Exception with error code:Unable to find any usable library in the system!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/creed/projects/pyocd/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 427, in list_ports
lib = PyPemicro.get_pemicro_lib()
File "/Users/creed/projects/pyocd/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 415, in get_pemicro_lib
raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: PEMicro Exception with error code:PEMicro Exception with error code:Unable to find any usable library in the system!
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/creed/projects/pyocd-pemicro/pyocd_pemicro/pemicro_probe.py", line 78, in get_all_connected_probes
port_list = pemicro.list_ports()
File "/Users/creed/projects/pyocd/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 429, in list_ports
raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: PEMicro Exception with error code:PEMicro Exception with error code:PEMicro Exception with error code:Unable to find any usable library in the system!
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/creed/projects/pyocd/pyocd/__main__.py", line 402, in run
self._COMMANDS[self._args.cmd](self)
File "/Users/creed/projects/pyocd/pyocd/__main__.py", line 462, in do_list
ConnectHelper.list_connected_probes()
File "/Users/creed/projects/pyocd/pyocd/core/helpers.py", line 109, in list_connected_probes
allProbes = ConnectHelper.get_all_connected_probes(blocking=False)
File "/Users/creed/projects/pyocd/pyocd/core/helpers.py", line 82, in get_all_connected_probes
allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
File "/Users/creed/projects/pyocd/pyocd/probe/aggregator.py", line 64, in get_all_connected_probes
probes += cls.get_all_connected_probes(unique_id, is_explicit)
File "/Users/creed/projects/pyocd-pemicro/pyocd_pemicro/pemicro_probe.py", line 83, in get_all_connected_probes
six.raise_from(cls._convert_exception(exc), exc)
File "<string>", line 3, in raise_from
pyocd.core.exceptions.ProbeError: PEMicro Exception with error code:PEMicro Exception with error code:PEMicro Exception with error code:Unable to find any usable library in the system!