Fixing the code from Python2 to python 3.6
Hi,
I open this issues to point out some changes that the code has to have to be able to run in python 3.6. First, the Print ""...have to changed to Print() then in blocktools.py,
The ord() funtion has to be removed in the line def hashStr(bytebuffer): return ''.join(('%02x'%ord(a)) for a in bytebuffer) In Python 2, bytestrings are the "standard" string objects, so that indexing into one returns the character at that position (itself a string) …
Python 2.7
b'whatever'[3] 't' … and calling ord() on the result behaves as expected:
ord(b'whatever'[3]) 116 However, in Python 3, everything is different: the standard string object is a Unicode string, and bytestrings are instead sequences of integers. Because of this, indexing into a bytestring returns the relevant integer directly …
Python 3.6
b'whatever'[3] 116 … so calling ord() on that integer makes no sense
Second in the block.py
the line print("\tCoinbase Text:\t %s" % hashStr(self.prevhash).decode("utf-8"))
in python 3.6 str has no longer a decode method, so they recommend removed, but im not sure, it is right.
Its seems that its working with this changes.
Hope this help,
Thanks and kid regards,
Iván
Thanks for taking the time here. I will check this out tonight and merge up