Im trying to get a private_key so, I tried this:
private_key = os.urandom(32).encode('hex')
But it throws this error:
AttributeError: 'bytes' object has no attribute 'encode'
So I check questions and solved that, in Python3x bytes can be only decode. Then I change it to:
private_key = os.urandom(32).decode('hex')
But now it throws this error:
LookupError: 'hex' is not a text encoding; use codecs.decode() to handle arbitrary codecs
And I really didnt understand why. When I tried this after last error;
private_key = os.urandom(32).codecs.decode('hex')
It says
AttributeError: 'bytes' object has no attribute 'codecs'
So I stuck, what can I do for fixing this? I heard this is working in Python 2x, but I need to use it in 3x.