graymauser / btcposbal2csv

List all bitcoin addresses with positive balance.
BSD 3-Clause "New" or "Revised" License
268 stars 201 forks source link

convert2ripemd160.py return error "'NoneType' object is not iterable" #20

Closed dolaor closed 3 years ago

dolaor commented 3 years ago

Hi!

Thank you for sharing your script.

I have tried to run convert2ripemd160.py on a .csv file containing 1 address per line (starting by "1" or "bc1") but it is returning an error (see below). The error appears when it hits adresses starting with "bc1" and if I remove them all in the .csv file there is no errors.

On Debian 10 with Python 3.7.3: Traceback (most recent call last): File "convert2ripemd160.py", line 46, in process(args.csvin) File "convert2ripemd160.py", line 22, in process ripemd_encoded = binascii.hexlify(bytearray(script_int)) TypeError: 'NoneType' object is not iterable

On Windows with Python 3.9.2: Traceback (most recent call last): File "C:\Users\Dolaor\Desktop\btcposbal2csv\convert2ripemd160.py", line 46, in process(args.csvin) File "C:\Users\Dolaor\Desktop\btcposbal2csv\convert2ripemd160.py", line 22, in process ripemd_encoded = binascii.hexlify(bytearray(script_int)) TypeError: cannot convert 'NoneType' object to bytearray

Thanks for your help.

dolaor commented 3 years ago

It is not an elegant solution but I had to add ",," at the end of each addresses (starting by "1" or "bc1") in the input .csv file containing one address per line. Then after running the command "convert2ripemd160.py input.csv > output.csv" the ripemd160 will be in the fourth column of the output .csv file.

bsubasic commented 3 years ago

Yes, it would be helpful to have an example output (on Github) from the btcposbal2csv.py script as convert2ripemd160.py expects exactly that format as input.

Then we would know how to format our input file if we use only convert2ripemd160.py.

By looking into the script code, it is: address, value_satoshi, last_height