Show
Ignore:
Timestamp:
10/05/08 11:21:53 (16 years ago)
Author:
jerome
Message:

Changed the way informations are output, especially to replace 'print'
statements which won't exist anymore in Python 3.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r3413 r3429  
    4747    def __init__(self, app, size=None) : 
    4848        """Initializes the engine.""" 
     49        self.isatty = sys.stdout.isatty() 
    4950        self.app = app 
    5051        self.size = None 
     
    6364    def display(self, msg) : 
    6465        """Displays the value.""" 
    65         self.app.display(msg) 
     66        if self.isatty : 
     67            self.app.display(msg) 
     68            sys.stdout.flush() 
    6669 
    6770    def oneMore(self) : 
     
    151154 
    152155    def display(self, message) : 
    153         """Display a message but only if stdout is a tty.""" 
    154         if sys.stdout.isatty() : 
    155             sys.stdout.write(message.encode(self.charset, \ 
     156        """Display a message after ensuring the correct charset is used.""" 
     157        sys.stdout.write(message.encode(self.charset, 
    156158                                            "replace")) 
    157             sys.stdout.flush() 
    158159 
    159160    def logdebug(self, message) :