def fix_win_pythonw_std_stream():
 if ((sys.platform == 'win32') and (os.path.basename(sys.executable) == 'pythonw.exe')):
  if (sys.stdout is None):
   sys.stdout = open(os.devnull, 'w')
  if (sys.stderr is None):
   sys.stderr = open(os.devnull, 'w')

def fix_win_pythonw_std_stream ( ) : if ( ( sys . platform == 'win32' ) and ( os . path . basename ( sys . executable ) == 'pythonw.exe' ) ) : if ( sys . stdout is None ) : sys . stdout = open ( os . devnull , 'w' ) if ( sys . stderr is None ) : sys . stderr = open ( os . devnull , 'w' )
on windows when running without a console the std[err|out] file descriptors are invalid and start throwing exceptions when their buffer is flushed .