How to fix TypeError: expected string or bytes-like object in Python | DevErrors