Browse Source

Fix "IOError: [Errno 32] Broken pipe" bug.

develop
Mike Hiretsky 12 years ago
parent
commit
d50ebb1492
  1. 10
      pym/cl_overriding.py
  2. 11
      pym/cl_print.py

10
pym/cl_overriding.py

@ -64,7 +64,10 @@ def printERROR(errMessage):
errMessage = str(errMessage)
errMessage += "\n"
sys.stderr.write(errMessage)
sys.stderr.flush()
try:
sys.stderr.flush()
except:
exit(1)
def printSUCCESS(message,printBR=True):
"""Вывод сообщения о успехе"""
@ -74,4 +77,7 @@ def printSUCCESS(message,printBR=True):
if printBR:
message += "\n"
sys.stdout.write(message)
sys.stdout.flush()
try:
sys.stdout.flush()
except IOError:
exit(1)

11
pym/cl_print.py

@ -17,6 +17,7 @@
import sys, struct, termios, fcntl
from cl_utils import _toUNICODE
import cl_overriding
class color_print(object):
_printSysOut = sys.stdout
@ -115,7 +116,10 @@ class color_print(object):
def defaultPrint(self, string):
self._printSysOut.write(string)
self._printSysOut.flush()
try:
self._printSysOut.flush()
except IOError:
cl_overriding.exit(1)
def printLine(self, argL, argR, offsetL=0, printBR=True):
"""Печатает справа и слева консоли цветные сообщения"""
@ -156,7 +160,10 @@ class color_print(object):
colorDict[''](rightString)
if printBR:
self._printSysOut.write("\n")
self._printSysOut.flush()
try:
self._printSysOut.flush()
except IOError:
cl_overriding.exit(1)
def printNotOK(self, string, offsetL=0, printBR=True):
"""Вывод на печать в случае сбоя"""

Loading…
Cancel
Save