Issue499973

classification
Title: isql.Prompt can't be written to stdout.
Type: Severity: normal
Components: Library Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: bzimmer Nosy List: bckfnn, bzimmer
Priority: normal Keywords:

Created on 2002-01-05.21:51:32 by bckfnn, last changed 2002-01-05.21:51:32 by bckfnn.

Messages
msg546 (view) Author: Finn Bock (bckfnn) Date: 2002-01-05.21:51:32
The __str__() method of the isql.Prompt class isn't 
magicly called when sys.stdout.write(self.prompt) is 
called. It result in a stacktrace:

Jython 2.1 on java1.3.0 (JIT: null)
Type "copyright", "credits" or "license" for more 
information.
>>> import dbexts, isql
>>> d=3Ddbexts.dbexts("prod_sport")
>>> D=3Disql.IsqlCmd(d)
>>> D.use_rawinput=3D0
>>> D.cmdloop()
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "/usr/local/jython/jython-2.1/Lib/cmd.py", line 
79, in cmdloop
TypeError: write(): 1st arg can't be coerced to String

I'm not sure that this have ever worked. Adding a 
__tojava__ method to the Prompt class seems to fix the 
problem.

        def __tojava__(self, cls):
            if cls == java.lang.String:
                return self.__str__()
            return None
History
Date User Action Args
2002-01-05 21:51:32bckfnncreate