In Python 3 I'm getting error TypeError: a bytes-like object is required, not 'bytearray'
I have a bytearray, which looks like this:
print(my_ba) # bytearray(b'}\x0e\x15/ow4|-')
If I enter this in the console it works:
>>> print(base58.b58encode(b'}\x0e\x15/ow4|-'))
2bKmhuGiGP7t8
But this gives an error, and I can't find out how to get the b'' string from the bytearray:
>>> print(base58.b58encode(my_ba))
TypeError: a bytes-like object is required, not 'bytearray'
I'm sure it's obvious, but how do I convert the bytearray to a string with a b
prefix?
print(base58.b58encode(bytes(my_ba))
- just convert itzlib.decompress
method