LedgerHQ / blue-loader-python

Python Loader for all Ledger devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Type error when loading application

DCRichards opened this issue · comments

Information

  • Python 2.7.6
  • ledgerblue 1.1.16

Description

When loading an application on the ledger, I am seeing the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/loadApp.py", line 174, in <module>
    loader.createApp(args.appFlags, appLength, args.appName, icon, path, None, None, args.appVersion)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 163, in createApp
    data = self.encryptAES(data)
  File "/usr/local/lib/python2.7/dist-packages/ledgerblue/hexLoader.py", line 95, in encryptAES
    encryptedData = cipher.encrypt(paddedData)
  File "/usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 244, in encrypt
    return self._cipher.encrypt(plaintext)
TypeError: argument must be string or read-only buffer, not bytearray
make: *** [load] Error 1

This appears to be due to the change to hexLoader.py here ed1e3a4 for Python 3 compatibility, which unfortunately does not with python 2.7.x.

Version 0.1.15 works correctly and as intended.

this is still broken in 0.1.17 , i fixed it for myself by getting pip to roll back to 0.1.15

pip install ledgerblue==0.1.15

you might need to sudo that if you are brave/stupid enough to do this with your system python

This doesn't seem to work at all in python3 because of other parts of the lib not being ported (e.g. you hit syntax errors for print statements) so i this is not great for this library

Could you please provide more details to reproduce ? (command being run, what's the firmware version of the dongle you're using)

using nano s with version 1.3.1 firmware on linux via vagrant , i am testing the cardano app for the ledger and it says not to use the newer 1.4 firmware yet. Error message is exactly as above when using versions greater than 0.1.15 . Using https://github.com/fix/ledger-vagrant on ubuntu 18.04 with https://github.com/HiddenField/ledger-cardano-app