Skip to content
  • Baptiste Jonglez's avatar
    Don't override sys.stdout · 568de8ac
    Baptiste Jonglez authored
    This caused Python3 (3.7.2 to be precise) to fail to print to stdout:
    
        Traceback (most recent call last):
          File "/home/zorun/.local/bin/himport", line 11, in <module>
            load_entry_point('himport', 'console_scripts', 'himport')()
          File "/home/zorun/tmp/himport/himport/cli.py", line 99, in main
            options = process_args()
          File "/home/zorun/tmp/himport/himport/cli.py", line 44, in process_args
            print(usage)
          File "/usr/lib/python3.7/codecs.py", line 378, in write
            self.stream.write(data)
        TypeError: write() argument must be str, not bytes
    
    After removing the sys.stdout redefinition, python3 is now happy, and
    python2 seems to still be able to print to stdout even with unicode
    characters.
    568de8ac