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

electrum-btcp is Python 3 but has a less compatible [historical] PY2 alias in bitcoin.py #91

Open
gnubyexample opened this issue Aug 23, 2018 · 0 comments

Comments

@gnubyexample
Copy link

gnubyexample commented Aug 23, 2018

.hex() alias unavailable in all versions of Python3

  File "/opt/local/electrum-btcp-P-1.1.1/lib/bitcoin.py", line 259, in <lambda>
    hash_to_str = lambda x: bytes(reversed(x)).hex()
AttributeError: 'bytes' object has no attribute 'hex'

Call chain is /usr/lib/python3.4/threading.py->electrum-btcp-P-1.1.1/lib/network.py->electrum-btcp-P-1.1.1/lib/blockchain.py->electrum-btcp-P-1.1.1/lib/bitcoin.py

#!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client

For compatibility of all Python3 (3.2, 3.4, 3.6) commonly used on Debian and Ubuntu in last couple of years, better to use binascii rather than rely on the hex() alias

( Last link mentions the hex() alias being reintroduced again, but local install support may be patchy depending on point release of Python 3 in installed standard system libraries )

Not sure what other local blockchain/btcp issues this would cause, if the hex() has failed because of user version of Python 3 running at the time.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

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

1 participant