sys.__stdout__.write

Here are the examples of the python api sys.__stdout__.write taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

21 Examples 7

Example 1

Project: pymo Source File: test_bsddb3.py
    def testCheckElapsedTime(self):
        # Print still working message since these tests can be really slow.
        now = time.time()
        if self.next_time <= now:
            TimingCheck.next_time = now + self._PRINT_WORKING_MSG_INTERVAL
            sys.__stdout__.write('  test_bsddb3 still working, be patient...\n')
            sys.__stdout__.flush()

Example 2

Project: qtop Source File: serialiser.py
    def _process_qstat_line(self, re_search, line, re_match_positions):
        """
        extracts data from a tabular qstat-like file
        returns a list
        """
        qstat_values = dict()
        m = re.search(re_search, line.strip())

        try:
            job_id, user, job_state, queue = [m.group(x) for x in re_match_positions]
        except AttributeError:
            sys.__stdout__.write('Line: %s not properly parsed by regex expression.\n' % line.strip())
            raise
        job_id = job_id.split('.')[0]
        user = user if not self.options.ANONYMIZE else self.anonymize(user, 'users')
        for key, value in [('JobId', job_id), ('UnixAccount', user), ('S', job_state), ('Queue', queue)]:
            qstat_values[key] = value
        return qstat_values

Example 3

Project: sublime-robot-plugin Source File: logger.py
Function: console
def console(msg, newline=True):
    """Writes the message to the console.

    If the `newline` argument is `True`, a newline character is automatically
    added to the message.
    """
    if newline:
        msg += '\n'
    sys.__stdout__.write(msg)

Example 4

Project: cldstk-deploy Source File: SimpleAsyncHTTPServer.py
Function: write
    def write(self, data):
        data = data.encode('utf-8')
        sys.__stdout__.write(data)
        self.f.write(data)
        if self.fl:
            self.f.flush()

Example 5

Project: py3status Source File: helpers.py
Function: print_line
def print_line(line):
    """
    Print given line to stdout (i3bar).
    """
    sys.__stdout__.write('{}\n'.format(line))
    sys.__stdout__.flush()

Example 6

Project: termite-data-server Source File: widget.py
Function: write
    def write(self, data):
        """   """

        sys.__stdout__.write(data)
        if hasattr(self, 'callback'):
            self.callback(data)
        else:
            self.buffer.write(data)

Example 7

Project: tsunami Source File: kassie.py
def arreter_MUD():
    """Fonction appelée pour arrêter le MUD proprement"""
    global importeur, log
    sys.__stdout__.write("\rArrêt du MUD en cours...\n")
    sys.__stdout__.flush()
    importeur.deconnecter_joueurs()

    importeur.tout_detruire()
    importeur.tout_arreter()
    log.info("Fin de la session\n\n\n")
    sys.exit(0)

Example 8

Project: green Source File: process.py
def ddebug(msg, err=None):  # pragma: no cover
    """
    err can be an instance of sys.exc_info() -- which is the latest traceback
    info
    """
    import os
    if err:
        err = ''.join(traceback.format_exception(*err))
    else:
        err = ''
    sys.__stdout__.write("({}) {} {}".format(os.getpid(), msg, err)+'\n')
    sys.__stdout__.flush()

Example 9

Project: IsisWorld Source File: developerconsole.py
Function: write_out
  def writeOut(self, line, copy = True):
    if copy: sys.__stdout__.write(line)
    lines = line.split('\n')
    firstline = lines.pop(0)
    self.lines[-1] += firstline
    self.lines += lines
    self.frame['text'] = '\n'.join(self.lines[-9:])

Example 10

Project: django-mmc Source File: mixins.py
Function: write
    def write(self, message):
        self.data.append(message)

        try:
            sys.__stdout__.write(message)
        except Exception as err:
            sys.stderr.write("{0}".format(err))

Example 11

Project: tmc.py Source File: unicode_characters.py
Function: write
    def write(self, text):
        if len(text) == 0:
            return
        if not self.use_unicode:
            text = self.pattern.sub(lambda x: self.chars[x.group()], text)
        sys.__stdout__.write(text)

Example 12

Project: git-goggles Source File: progress.py
    def uncapture_stdout(self):
        sys.__stdout__.write(''.ljust(self.max_length))
        sys.__stdout__.write('\r')
        sys.stdout = self._stdout
        console(force_unicode(self._capture_stdout.getvalue()))
        self._capture_stdout = StringIO.StringIO()

Example 13

Project: git-goggles Source File: progress.py
Function: emit
    def emit(self, record):
        if self.msg != record.msg:
            self.msg = record.msg
            msg = ' %s   %s' % (self.spinner[0], self.msg)
            self.max_length = max(len(msg), self.max_length)
            self.spinner = self.spinner[1:] + self.spinner[:1]
            sys.__stdout__.write(force_str(msg.ljust(self.max_length)))
            sys.__stdout__.write('\r')

Example 14

Project: cg-logging Source File: cgLogging.py
Function: emit
	def emit(self, record):

		try:
			sys.__stdout__.write( "%s\n" %self.format(record) )
		except IOError:
			## MotionBuilder is doing something funky with python,
			## so sometimes ( not always ) is blocked from writting:
			sys.stdout.write( "%s\n" %self.format(record) )

Example 15

Project: pymo Source File: PyParse.py
Function: dump
    def dump(*stuff):
        sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")

Example 16

Project: robotframework Source File: LibUsingPyLogging.py
Function: emit
    def emit(self, record):
        sys.__stdout__.write(record.getMessage().title() + '\n')

Example 17

Project: robotframework Source File: Listener.py
Function: log
    def _log(self, message):
        sys.__stdout__.write("[{0}]\n".format(message))

Example 18

Project: qnotero Source File: setup-windows.py
Function: write
	def write(self, msg):	
		if isinstance(msg, str):
			msg = msg.encode('ascii', 'ignore')
		sys.__stdout__.write(msg.decode('ascii'))

Example 19

Project: tsunami Source File: __init__.py
Function: input
    def input(self):
        """Récupère l'input de l'utilisateur."""
        if not importeur.serveur.lance:
            return

        sys.__stdout__.write("\r" + self.prompt)
        sys.__stdout__.flush()
        try:
            code = input()
        except (KeyboardInterrupt, EOFError):
            importeur.serveur.lance = False
            return

        stdout = sys.stdout
        stderr = sys.stderr
        sys.stdout = sys.__stdout__
        sys.stderr = sys.__stderr__
        try:
            ret = self.console.push(code)
        except Exception:
            print(traceback.format_exc())
        else:
            self.prompt = "... " if ret else ">>> "
        finally:
            sys.stdout = stdout
            sys.stderr = stderr

Example 20

Project: pythonVSCode Source File: ipythonServer.py
Function: debug_write
def _debug_write(out):
    if DEBUG:
        sys.__stdout__.write(out)
        sys.__stdout__.write("\n")
        sys.__stdout__.flush()

Example 21

Project: pythonVSCode Source File: visualstudio_py_repl.py
Function: debug_write
def _debug_write(out):
    if DEBUG:
        sys.__stdout__.write(out)
        sys.__stdout__.flush()