Skip to content

Error when adding account from Ledger Nano X #46

@craig-openlaw

Description

@craig-openlaw

Environment information

  • ape and plugin versions:
$ ape --version
0.8.5

$ ape plugins list
Installed Plugins
  ledger    0.8.1.dev1+g7725b01
  safe      0.8.2
  tokens    0.8.0
  • Python Version: 3.12.3
  • OS: Ubuntu 24.04

What went wrong?

When trying to add an account from a Leger Nano X it fails with the error: "AttributeError: module 'hid' has no attribute 'device'. Did you mean: 'Device'?"

Please include information like:

I ran: ape ledger add ledger

The ape program failed with this trace:

$ ape ledger add ledger
Traceback (most recent call last):
  File "/home/c/.python/bin/ape", line 33, in <module>
    sys.exit(load_entry_point('eth-ape==0.8.5', 'console_scripts', 'ape')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape/_cli.py", line 104, in invoke
    return super().invoke(ctx)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/_cli.py", line 74, in add
    address, account_hd_path = _select_account(hd_path)
                               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/_cli.py", line 23, in _select_account
    return choices.get_user_selected_account()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/choices.py", line 67, in get_user_selected_account
    self._load_choices()
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/choices.py", line 98, in _load_choices
    self.choices = [self._get_address(i) for i in index_range]
                    ^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/choices.py", line 103, in _get_address
    return device.get_address()
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/client.py", line 56, in get_address
    return get_account_by_path(self._account, dongle=self.dongle).address
                                                     ^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/client.py", line 46, in dongle
    device = get_dongle(debug=debug)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ape_ledger-0.8.1.dev1+g7725b01-py3.12.egg/ape_ledger/client.py", line 28, in get_dongle
    return getDongle(debug=debug)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/c/.python/lib/python3.12/site-packages/ledgerblue/comm.py", line 360, in getDongle
    dev = hid.device()
          ^^^^^^^^^^
AttributeError: module 'hid' has no attribute 'device'. Did you mean: 'Device'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions