I am trying to decode previously encoded and stored in mysql but ending up with binascii.Error: Incorrect padding error. I have been using sqllite for a while with same functionality used to work . When I changed to mysql it broke things . Any help with it is much appreciated.
>>> base64.decodebytes(dbins.user_pass)
Traceback (most recent call last):
File "D:\Development\sss\pyenv\lib\base64.py", line 517, in _input_type_check
m = memoryview(s)
TypeError: memoryview: a bytes-like object is required, not 'str'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\Development\sss\pyenv\lib\base64.py", line 552, in decodebytes
_input_type_check(s)
File "D:\Development\sss\pyenv\lib\base64.py", line 520, in _input_type_check
raise TypeError(msg) from err
TypeError: expected bytes-like object, not str
>>> base64.decodebytes(dbins.user_pass.encode("utf-8"))
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "D:\Development\sss\pyenv\lib\base64.py", line 553, in decodebytes
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
Uday.