We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee73086 commit 758cd1cCopy full SHA for 758cd1c
graphtools/logging.py
@@ -3,6 +3,7 @@
3
import os
4
import logging
5
import time
6
+import sys
7
8
9
__logger_name__ = "graphtools"
@@ -14,11 +15,21 @@ class RSafeStdErr(object):
14
15
This class writes directly to stderr to avoid this.
16
"""
17
- def write(self, msg):
18
- os.write(2, bytes(msg, 'utf8'))
+ def __init__(self):
19
+ try:
20
+ __IPYTHON__
21
+ self.write = self.write_ipython
22
+ except NameError:
23
+ self.write = self.write_r_safe
24
+
25
+ def write_ipython(self, msg):
26
+ print(msg, end='', file=sys.stdout)
27
28
+ def write_r_safe(self, msg):
29
+ os.write(1, bytes(msg, 'utf8'))
30
31
def flush(self):
- pass
32
+ sys.stdout.flush()
33
34
35
class TaskLogger(object):
0 commit comments