Closed posita closed 8 years ago
Fixed this issue in e940cb661b623b9f85fac4e7896171f907927bf7. Another one in 5fdb048b2e077fa4c378127d3c8d1b8628d1c43a.
There is still (at least) one to go:
$ python3 test_mnemonic.py
...
ERROR: test_to_entropy (__main__.MnemonicTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_mnemonic.py", line 222, in test_to_entropy
self.assertEqual(m.to_entropy(m.to_mnemonic(d).split()), d)
File "/home/stick/work/trezor/python-mnemonic/mnemonic/mnemonic.py", line 118, in to_entropy
hashBits = list(itertools.chain.from_iterable(( [ ord(c) & (1 << (7 - i)) != 0 for i in range(8) ] for c in hashBytes )))
File "/home/stick/work/trezor/python-mnemonic/mnemonic/mnemonic.py", line 118, in <genexpr>
hashBits = list(itertools.chain.from_iterable(( [ ord(c) & (1 << (7 - i)) != 0 for i in range(8) ] for c in hashBytes )))
File "/home/stick/work/trezor/python-mnemonic/mnemonic/mnemonic.py", line 118, in <listcomp>
hashBits = list(itertools.chain.from_iterable(( [ ord(c) & (1 << (7 - i)) != 0 for i in range(8) ] for c in hashBytes )))
TypeError: ord() expected string of length 1, but int found
If one wants to avoid introducing dependencies on compatibility toolkits like python-future, I found this helpful.
One can see build failures here: https://travis-ci.org/trezor/python-mnemonic
I would love to see a Python 3 expert fixing them while not breaking Python 2 and at the same time not introducing a lot of unnecessary changes.
I fixed all issues in mnemonic code and pushed 0.14 out.
SSSS module is still not ready yet, but as it is unused in any production code I am closing this issue.
You are welcome to help with fixing the issue, though (just run python3 test_shamir.py
) to see the errrors.
@prusnak, should I open another issue to track SSSS -> Python 3 migration specifically?
No. Only pull requests are allowed. :-)
Shamir fixed in https://github.com/trezor/python-mnemonic/commit/f9f7720ab79b07a86e0c10071d56d2a3ed5ab27c
Released as 0.15
Currently, this package fails to run with Python 3, due at least to the use of
long
s in thesecretsharing
package: