Using Python3, os.write refuse to write str objects. Conversion to bytes needed.