Message546

Author bckfnn
Recipients
Date 2002-01-05.21:51:32
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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
2008-02-20 17:16:59adminlinkissue499973 messages
2008-02-20 17:16:59admincreate