ethereum / genesis_block_generator

34 stars 255 forks source link

Test for Python 3.x and block off #4

Open linagee opened 9 years ago

linagee commented 9 years ago

CanaryInTheMine found that Python 3.x doesn't work. Someone should either:

1) Detect Python 3.x users and tell them to downgrade to Python 2.x or 2) Fix the code to work in both Python 2.x and Python 3.x (eww)

This looks close: http://stackoverflow.com/questions/11277721/python-2-code-if-python-3-then-sys-exit

(Or just update blog posts/documentation and tell people to use Python 2.x, this is the easiest!)

MiWCryptoCurrency commented 9 years ago

I got this to work on py3 with 2 slight tweaks -- the print() and removing the hex conversion from EXTRADATA. Its being echoed from argv to the json as an hexstring so it wont need conversion back to buffered int. In the case where --extradata is not defined, a default EXTRADATA='00' would send the appropriate "0x00" to the json (If that is the correct encoding for null EXTRADATA).

The pythonbitcointools requires a bytes to string conversion in bci.py on py3 too. I have left a comment on its py3 issue page for the project.

you can support print() with import future for compat with py2 and py3