A wrapper for print() that uses stderr by default.
506951
def print_err(*args, **kwargs):
    
    if kwargs.get('file', None) is None:
        kwargs['file'] = sys.stderr

    color = dict_pop_or(kwargs, 'color', True)
    # Use color if asked, but only if the file is a tty.
    if color and kwargs['file'].isatty():
        # Keep any Colr args passed, convert strs into Colrs.
        msg = kwargs.get('sep', ' ').join(
            str(a) if isinstance(a, C) else str(C(a, 'red'))
            for a in args
        )
    else:
        # The file is not a tty anyway, no escape codes.
        msg = kwargs.get('sep', ' ').join(
            str(a.stripped() if isinstance(a, C) else a)
            for a in args
        )
    newline = dict_pop_or(kwargs, 'newline', False)
    if newline:
        msg = '\n{}'.format(msg)
    print(msg, **kwargs)
328005
def print(self, *args, **kwargs):
        '''
        
        '''
        if self._last_args and self._last_args.verbose:
            print(*args, **kwargs)
682584
def printf(*s) :
	''
	for e in s[:-1] :
		print e,
	print s[-1]

	sys.stdout.flush()
444926
def print_safe(str_or_bytes, encoding='utf-8', errors='ignore', output=sys.stdout, newline='\n'):
    
    writer = output.buffer if hasattr(output, 'buffer') else output

    # When the input type is bytes, verify it can be decoded with the specified encoding.
    decoded = str_or_bytes if is_unicode(str_or_bytes) else to_unicode(str_or_bytes, encoding, errors)
    encoded = to_bytes(decoded, encoding, errors)

    writer.write(encoded + to_bytes(newline, encoding, errors))
    output.flush()
1367989
def try_printout(data, out, opts, **kwargs):
    '''
    
    '''
    try:
        printout = get_printout(out, opts)(data, **kwargs)
        if printout is not None:
            return printout.rstrip()
    except (KeyError, AttributeError, TypeError):
        log.debug(traceback.format_exc())
        try:
            printout = get_printout('nested', opts)(data, **kwargs)
            if printout is not None:
                return printout.rstrip()
        except (KeyError, AttributeError, TypeError):
            log.error('Nested output failed: ', exc_info=True)
            printout = get_printout('raw', opts)(data, **kwargs)
            if printout is not None:
                return printout.rstrip()
874590
def stderr_with_input(cmd, stdin):
    """"""
    handle, gpg_stderr = stderr_handle()
    LOGGER.debug("GPG command %s", ' '.join(cmd))
    try:
        gpg_proc = subprocess.Popen(cmd,  # nosec
                                    stdout=subprocess.PIPE,
                                    stdin=subprocess.PIPE,
                                    stderr=gpg_stderr)

        output, _err = gpg_proc.communicate(polite_bytes(stdin))

        if handle:
            handle.close()

        return output
    except subprocess.CalledProcessError as exception:
        return gpg_error(exception, 'GPG variable encryption error')
    except OSError as exception:
        raise CryptoritoError("File %s not found" % exception.filename)
109786
def stderr_handle():
    """"""
    gpg_stderr = None
    handle = None
    if LOGGER.getEffectiveLevel() > logging.DEBUG:
        handle = open(os.devnull, 'wb')
        gpg_stderr = handle

    return handle, gpg_stderr
1076272
def print(cls, *args, **kwargs):
        """"""
        # pylint: disable=protected-access
        with _shared._PRINT_LOCK:
            print(*args, **kwargs)
            _sys.stdout.flush()
1094249
def _read_stderr(self):
        """"""
        # We need to read stderr_file as bytes to be able to
        # detect its encoding with chardet
        f = open(self.stderr_file, 'rb')

        try:
            stderr_text = f.read()

            # This is needed to avoid showing an empty error message
            # when the kernel takes too much time to start.
            # See issue 8581
            if not stderr_text:
                return ''

            # This is needed since the stderr file could be encoded
            # in something different to utf-8.
            # See issue 4191
            encoding = get_coding(stderr_text)
            stderr_text = to_text_string(stderr_text, encoding)
            return stderr_text
        finally:
            f.close()
215668
def eout(s):
    

    if allow_print: 
       if con_encoding=='':
          x=sys.stdin.encoding
          if x==None: 
             b=s.encode()
          else:
             b=s.encode(x, 'ignore')
       else:
          b=s.encode(con_encoding, 'ignore')

       if sys.version_info[0]>2:
          try: # We encountered issues on ipython with Anaconda
               # and hence made this work around
             sys.stderr.buffer.write(b)
             sys.stderr.buffer.write(b'\n')
          except Exception as e: 
             sys.stderr.write(s)
             pass
       else:
          sys.stderr.write(b)

    sys.stderr.flush()

    return None
502976
def stderr(self):
        
        streams = self._payload.get('streams', None)
        return streams[1] if streams is not None and len(streams) >= 2 else ''
1333570
def _print_err(*args):
    
    if not CFG.debug:
        return
    if not args:
        return
    encoding = 'utf8' if os.name == 'posix' else 'gbk'
    args = [_cs(a, encoding) for a in args]
    f_back = None
    try:
        raise Exception
    except:
        f_back = sys.exc_traceback.tb_frame.f_back
    f_name = f_back.f_code.co_name
    filename = os.path.basename(f_back.f_code.co_filename)
    m_name = os.path.splitext(filename)[0]
    prefix = ('[%s.%s]'%(m_name, f_name)).ljust(20, ' ')
    print bcolors.FAIL+'[%s]'%str(datetime.datetime.now()), prefix, ' '.join(args) + bcolors.ENDC
1031829
def soft_error(self, message):
        

        self.print_usage(sys.stderr)
        args = {'prog': self.prog, 'message': message}
        self._print_message(
            _('%(prog)s: error: %(message)s\n') % args, sys.stderr)
495744
def flushed_print(*args, **kwargs):
    
    print(*args, **kwargs)
    file = kwargs.get('file', sys.stdout)
    file.flush() if file is not None else sys.stdout.flush()
322939
def _redirect_stderr():
    
    sys.stderr.flush()
    stderr_fileno = sys.stderr.fileno()
    orig_stderr = os.dup(stderr_fileno)
    devnull = os.open(os.devnull, os.O_WRONLY)
    os.dup2(devnull, stderr_fileno)
    os.close(devnull)
    return orig_stderr
741414
def stderr_handle(self):
        """"""
        if self.stderr_file is not None:
            # Needed to prevent any error that could appear.
            # See issue 6267
            try:
                handle = codecs.open(self.stderr_file, 'w', encoding='utf-8')
            except Exception:
                handle = None
        else:
            handle = None

        return handle
12393
function printError(error) {
    process.stderr.write(red);
    console.error(error.trace);
    process.stderr.write(yellow);
    console.error('an error occurred, please file an issue');
    process.stderr.write(reset);
    process.exit(1);
  }