trezor / python-trezor

:snake: Don't use this repo, use the new monorepo instead:
https://github.com/trezor/trezor-firmware
GNU Lesser General Public License v3.0
201 stars 194 forks source link

error in firmware_update from URL #304

Closed strmci closed 5 years ago

strmci commented 6 years ago

AttributeError: 'str' object has no attribute 'write'

strmci commented 6 years ago

Tried this command:

trezorctl firmware_update -u https://github.com/trezor/webwallet-data/blob/master/firmware/1/trezor-1.5.0.bin

Error:

Traceback (most recent call last):
  File "/home/tomas/.local/bin/trezorctl", line 1059, in <module>
    cli()  # pylint: disable=E1120
  File "/home/tomas/.local/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/tomas/.local/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/tomas/.local/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/tomas/.local/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tomas/.local/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/tomas/.local/lib/python3.6/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/tomas/.local/bin/trezorctl", line 425, in firmware_update
    click.echo('Downloading from', url)
  File "/home/tomas/.local/lib/python3.6/site-packages/click/utils.py", line 259, in echo
    file.write(message)
AttributeError: 'str' object has no attribute 'write'
prusnak commented 6 years ago

The following URL is not a firmware: https://github.com/trezor/webwallet-data/blob/master/firmware/1/trezor-1.5.0.bin

It's a Github page

If you want link to firmware, you need to click "Download" on that page. This links point to https://github.com/trezor/webwallet-data/raw/master/firmware/1/trezor-1.5.0.bin which is a correct URL.

Anyway, I think the error message should be much less cryptic than it is now.

matejcik commented 6 years ago

@prusnak that's also not the cause of the problem, it's an incorrect call to click.echo