`.encode('ascii',errors='replace')` was your solution?