How to fix TypeError: a bytes-like object is required, not 'str' in Python | DevErrors