invoke cmi with Python 3 fixing encoding issues