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
3
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()
3
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
3
Example 3
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)
3
Example 4
def write(self, data):
data = data.encode('utf-8')
sys.__stdout__.write(data)
self.f.write(data)
if self.fl:
self.f.flush()
3
Example 5
def print_line(line):
"""
Print given line to stdout (i3bar).
"""
sys.__stdout__.write('{}\n'.format(line))
sys.__stdout__.flush()
3
Example 6
def write(self, data):
""" """
sys.__stdout__.write(data)
if hasattr(self, 'callback'):
self.callback(data)
else:
self.buffer.write(data)
3
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)
3
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()
3
Example 9
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:])
3
Example 10
def write(self, message):
self.data.append(message)
try:
sys.__stdout__.write(message)
except Exception as err:
sys.stderr.write("{0}".format(err))
3
Example 11
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)
3
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()
3
Example 13
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')
3
Example 14
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) )
0
Example 15
def dump(*stuff):
sys.__stdout__.write(" ".join(map(str, stuff)) + "\n")
0
Example 16
def emit(self, record):
sys.__stdout__.write(record.getMessage().title() + '\n')
0
Example 17
def _log(self, message):
sys.__stdout__.write("[{0}]\n".format(message))
0
Example 18
def write(self, msg):
if isinstance(msg, str):
msg = msg.encode('ascii', 'ignore')
sys.__stdout__.write(msg.decode('ascii'))
0
Example 19
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
0
Example 20
def _debug_write(out):
if DEBUG:
sys.__stdout__.write(out)
sys.__stdout__.write("\n")
sys.__stdout__.flush()
0
Example 21
def _debug_write(out):
if DEBUG:
sys.__stdout__.write(out)
sys.__stdout__.flush()