pyOCD icon indicating copy to clipboard operation
pyOCD copied to clipboard

pyocd_pemicro/pemicro_probe: AttributeError: 'PEMicroException' object has no attribute 'message' + FreeBSD/*BSD detection blocker

Open cederom opened this issue 3 years ago • 2 comments

Hello world :-)

I have encountered a blocker traceback on pyocd (i.e. pyocd list or pyocd flash) related to pyocd_pemicro/pemicro_probe:

(venv37zephyr) pyocd list
0001271:CRITICAL:__main__:uncaught exception: 'PEMicroException' object has no attribute 'message'
Traceback (most recent call last):
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 401, in get_pemicro_lib
    libs_list = PyPemicro.get_pemicro_lib_list(dllpath=dllpath)
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 142, in get_pemicro_lib_list
    lib_name = PyPemicro.get_library_name()
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 99, in get_library_name
    raise PEMicroException(f"Unable to determinate running operation system ({system_name})")
pypemicro.pemicro.PEMicroException: Unable to determinate running operation system (FreeBSD)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 419, in list_ports
    lib = PyPemicro.get_pemicro_lib()
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 407, in get_pemicro_lib
    raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: Unable to determinate running operation system (FreeBSD)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd_pemicro/pemicro_probe.py", line 82, in get_all_connected_probes
    port_list = pemicro.list_ports()
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pypemicro/pemicro.py", line 421, in list_ports
    raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: Unable to determinate running operation system (FreeBSD)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg/pyocd/__main__.py", line 150, in run
    status = cmd.invoke()
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg/pyocd/subcommands/list_cmd.py", line 93, in invoke
    ConnectHelper.list_connected_probes()
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg/pyocd/core/helpers.py", line 109, in list_connected_probes
    allProbes = ConnectHelper.get_all_connected_probes(blocking=False)
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg/pyocd/core/helpers.py", line 82, in get_all_connected_probes
    allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg/pyocd/probe/aggregator.py", line 64, in get_all_connected_probes
    probes += cls.get_all_connected_probes(unique_id, is_explicit)
  File "/home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd_pemicro/pemicro_probe.py", line 89, in get_all_connected_probes
    if cls.NO_LIBRARY_ERR in exc.message:
AttributeError: 'PEMicroException' object has no attribute 'message'

My envronment:

(venv37zephyr) uname -a
FreeBSD hexagon 12.2-RELEASE-p6 FreeBSD 12.2-RELEASE-p6 GENERIC  amd64

(venv37zephyr) pip show pyocd
Name: pyocd
Version: 0.30.4.dev31
Summary: Cortex-M debugger for Python
Home-page: https://github.com/pyocd/pyOCD
Author: Chris Reed, Martin Kojtal
Author-email: [email protected], [email protected]
License: Apache 2.0
Location: /home/x/usr/local/venv37zephyr/lib/python3.7/site-packages/pyocd-0.30.4.dev31-py3.7.egg
Requires: capstone, cmsis-pack-manager, colorama, intelhex, intervaltree, naturalsort, prettytable, pyelftools, pylink-square, pyocd-pemicro, pyusb, pyyaml, six, hidapi
Required-by:

(venv37zephyr) pip show pyocd-pemicro
Name: pyocd-pemicro
Version: 1.0.3
Summary: PyOCD debug probe plugin for PEMicro debug probes
Home-page: https://github.com/pyocd/pyocd-pemicro
Author: Petr Gargulak
Author-email: [email protected]
License: BSD-3-Clause
Location: /home/x/usr/local/venv37zephyr/lib/python3.7/site-packages
Requires: pypemicro, six
Required-by: pyocd

Either version mismatch between pyocd and pyocd-pemicro or no support for FreeBSD (*BSD) on pyocd-pemicro. Work in progress :-)

Btw. why separate pyocd-pemicro dependency to pyocd?

cederom avatar May 12 '21 15:05 cederom

Okay, this problem seems to be reported in https://github.com/pyocd/pyocd-pemicro/issues/2 and fixed already in the upstream master.

I now have OS detection problem that I will reported here https://github.com/pyocd/pyocd-pemicro/issues/4.

cederom avatar May 12 '21 16:05 cederom

By the way - if we are not interested in this PEMicro - should that block use of pyOCD?

cederom avatar May 12 '21 16:05 cederom