fix error with python3: stderr.write() expects strings, not bytes