Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'PEMicroException' object has no attribute 'message' #2

Closed
anthrax-0 opened this issue Apr 1, 2021 · 3 comments
Closed

Comments

@anthrax-0
Copy link

anthrax-0 commented Apr 1, 2021

As pypemicro package has removed the message field in the latest version 0.1.6, the current version of pyocd-pemicro can't catch specific exceptions and being now installed by default it always fails pyocd on the system without libraries @flit :

:#sudo pyocd list
0001632:CRITICAL:__main__:uncaught exception: 'PEMicroException' object has no attribute 'message'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pypemicro/pemicro.py", line 403, in get_pemicro_lib
    filename = PyPemicro.get_newest_lib_filename(libs_list)
  File "/usr/local/lib/python3.7/dist-packages/pypemicro/pemicro.py", line 381, in get_newest_lib_filename
    raise PEMicroException("Unable to find any usable library in the system!")
pypemicro.pemicro.PEMicroException: Unable to find any usable library in the system!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pypemicro/pemicro.py", line 419, in list_ports
    lib = PyPemicro.get_pemicro_lib()
  File "/usr/local/lib/python3.7/dist-packages/pypemicro/pemicro.py", line 407, in get_pemicro_lib
    raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: Unable to find any usable library in the system!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pyocd_pemicro/pemicro_probe.py", line 82, in get_all_connected_probes
    port_list = pemicro.list_ports()
  File "/usr/local/lib/python3.7/dist-packages/pypemicro/pemicro.py", line 421, in list_ports
    raise PEMicroException(str(exc))
pypemicro.pemicro.PEMicroException: Unable to find any usable library in the system!

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pyocd/__main__.py", line 401, in run
    self._COMMANDS[self._args.cmd](self)
  File "/usr/local/lib/python3.7/dist-packages/pyocd/__main__.py", line 461, in do_list
    ConnectHelper.list_connected_probes()
  File "/usr/local/lib/python3.7/dist-packages/pyocd/core/helpers.py", line 109, in list_connected_probes
    allProbes = ConnectHelper.get_all_connected_probes(blocking=False)
  File "/usr/local/lib/python3.7/dist-packages/pyocd/core/helpers.py", line 82, in get_all_connected_probes
    allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
  File "/usr/local/lib/python3.7/dist-packages/pyocd/probe/aggregator.py", line 64, in get_all_connected_probes
    probes += cls.get_all_connected_probes(unique_id, is_explicit)
  File "/usr/local/lib/python3.7/dist-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' 

All two instances of if cls.NO_LIBRARY_ERR not in exc.message: has to be replaced.
For example, if cls.NO_LIBRARY_ERR not in str(exc): seems to work.

@anthrax-0
Copy link
Author

Sorry for the comments spamming. It seems https://github.com/pyocd/pyocd-pemicro/blob/main/pyocd_pemicro/pemicro_probe.py#L107 should actually be if cls.NO_LIBRARY_ERR in str(exc):

@flit
Copy link
Member

flit commented Apr 10, 2021

Thanks for the report! I'll pin the version of pypemicro so this can't happen again.

@flit flit closed this as completed Apr 10, 2021
@cederom
Copy link
Contributor

cederom commented May 12, 2021

I have also encountered this problem, reported here pyocd/pyOCD#1154. Will try the pyocd-pemicro master and report back :-)

Update: I can confirm this is fixed in the master. I now have problem with OS detection, will report in a separate issue :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants