parameters: (cmd, mode='r', bufsize=None)
docstring: Portable popen() interface.
docstring_summary: Portable popen() interface.
docstring_tokens: Portable popen () interface .
function: def popen(cmd, mode='r', bufsize=None):
  
      """ Portable popen() interface.
      """
      # Find a working popen implementation preferring win32pipe.popen
      # over os.popen over _popen
      popen = None
      if os.environ.get('OS','') == 'Windows_NT':
          # On NT win32pipe should work; on Win9x it hangs due to bugs
          # in the MS C lib (see MS KnowledgeBase article Q150956)
          try:
              import win32pipe
          except ImportError:
              pass
          else:
              popen = win32pipe.popen
      if popen is None:
          if hasattr(os,'popen'):
              popen = os.popen
              # Check whether it works... it doesn't in GUI programs
              # on Windows platforms
              if sys.platform == 'win32': # XXX Others too ?
                  try:
                      popen('')
                  except os.error:
                      popen = _popen
          else:
              popen = _popen
      if bufsize is None:
          return popen(cmd,mode)
      else:
          return popen(cmd,mode,bufsize)
function_tokens: def popen ( cmd , mode = 'r' , bufsize = None ) : # Find a working popen implementation preferring win32pipe.popen # over os.popen over _popen popen = None if os . environ . get ( 'OS' , '' ) == 'Windows_NT' : # On NT win32pipe should work; on Win9x it hangs due to bugs # in the MS C lib (see MS KnowledgeBase article Q150956) try : import win32pipe except ImportError : pass else : popen = win32pipe . popen if popen is None : if hasattr ( os , 'popen' ) : popen = os . popen # Check whether it works... it doesn't in GUI programs # on Windows platforms if sys . platform == 'win32' : # XXX Others too ? try : popen ( '' ) except os . error : popen = _popen else : popen = _popen if bufsize is None : return popen ( cmd , mode ) else : return popen ( cmd , mode , bufsize )