pyocd / pyocd-pemicro

PEMicro probe plugin for pyOCD
Other
3 stars 1 forks source link

Exception if PEMicro drivers are not installed #1

Closed flit closed 3 years ago

flit commented 3 years ago

The following exceptions occur if the pyocd-pemicro plugin is installed, but not the PEMicro drivers, and you attempt to run pyocd list.

On macOS 10.15:

0000705:CRITICAL:__main__:uncaught exception: dlopen(unitacmp-64.dylib, 6): image not found
Traceback (most recent call last):
  File "/Volumes/projects/pyOCD-flit/pyocd/__main__.py", line 398, in run
    self._COMMANDS[self._args.cmd](self)
  File "/Volumes/projects/pyOCD-flit/pyocd/__main__.py", line 458, in do_list
    ConnectHelper.list_connected_probes()
  File "/Volumes/projects/pyOCD-flit/pyocd/core/helpers.py", line 109, in list_connected_probes
    allProbes = ConnectHelper.get_all_connected_probes(blocking=False)
  File "/Volumes/projects/pyOCD-flit/pyocd/core/helpers.py", line 82, in get_all_connected_probes
    allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
  File "/Volumes/projects/pyOCD-flit/pyocd/probe/aggregator.py", line 64, in get_all_connected_probes
    probes += cls.get_all_connected_probes(unique_id, is_explicit)
  File "/Volumes/projects/pyOCD-flit/venv/mac39/lib/python3.9/site-packages/pyocd_pemicro/pemicro_probe.py", line 78, in get_all_connected_probes
    port_list = pemicro.list_ports()
  File "/Volumes/projects/pyOCD-flit/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 423, in list_ports
    lib = PyPemicro.get_pemicro_lib()
  File "/Volumes/projects/pyOCD-flit/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 405, in get_pemicro_lib
    libs_list = PyPemicro.get_pemicro_lib_list(dllpath=dllpath)
  File "/Volumes/projects/pyOCD-flit/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 162, in get_pemicro_lib_list
    library_dlls.append(PyPemicro._load_pemicro_lib_info("", lib_name))
  File "/Volumes/projects/pyOCD-flit/venv/mac39/lib/python3.9/site-packages/pypemicro/pemicro.py", line 124, in _load_pemicro_lib_info
    dll = cdll.LoadLibrary(os.path.join(dll_path, lib_name))
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(unitacmp-64.dylib, 6): image not found

RaspberryPi looks similar with a slightly different error message:

0002117:CRITICAL:__main__:uncaught exception: unitacmp-64.so: cannot open shared object file: No such file or directory
Gargy007 commented 3 years ago

I will look at it, the Linux is generating different kind of exception and I don't catch it in caller function as on Windows, thanks for reporting.

flit commented 3 years ago

Thanks!