From: brian z. <bz...@zi...> - 2002-01-07 05:28:01
|
Steve, I tested isql on my Linux box with the Readline binary from the url you pointed out earlier and was unable to reproduce the exception. I see that cmd.py doesn't work with the Readline console, but I don't get any exceptions. I tested this with the latest CVS (2.1+) and Python 2.2 Lib. In addition, I checked in a new version of isql but I doubt that would have fixed this. brian > -----Original Message----- > From: Steve Cohen > [mailto:jyt...@li...] On Behalf > Of Steve Cohen > Sent: Saturday, January 05, 2002 8:53 AM > To: Finn Bock; jyt...@li... > Subject: RE: [Jython-users] More fun with Readline > > > There is a stack trace and it's the same whether or not > showJavaExceptions is true: > > [scohen@sleepingbear scohen]$ jython > -Dpython.options.showJavaExceptions=true > Jython 2.1 on java1.3.0 (JIT: null) > Type "copyright", "credits" or "license" for more information. > >>> import dbexts, isql > >>> d=dbexts.dbexts("prod_sport") > >>> D=isql.IsqlCmd(d) > >>> D.use_rawinput=0 > >>> 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 > > The 1st arg is None, which is arguably a bug in isql.IsqlCmd. > The code in cmdloop can't handle it (can't coerce it to > String). I can work around the bug by explicitly setting > D.prompt (which is the first argument passed in) before > executing D.cmdloop() but then you are quite right, there > still isn't support for any form of readline, either the > java_readline that is in the interactive mode or even the > Ctrl-N, Ctrl-P stuff that the documentation speaks of. > > I suppose I could take a look at fixing this, although I'm > not extremely familiar with it. If you could point me to > where the java_readline stuff is integrated into the > interactive mode, I could have a go at it. Or, if you'd > rather have someone more familiar with the internals do it, I > certainly understand. > > > -----Original Message----- > From: Finn Bock > Sent: Sat 1/5/2002 7:44 AM > To: jyt...@li... > Cc: Steve Cohen > Subject: Re: [Jython-users] More fun with Readline > [Steve Cohen] > > >Now that I have readline working with jython, I come quickly to the > >next hurdle. Is it possible to integrate readline capabilities into > >jython-coded command interpreters based on cmd.Cmd? I > cannot get this > >to work at all. The docs on cmd.Cmd gave me some hope, but > I can't get > >any of it to work, not even the Ctrl-P, Ctrl-N stuff. I also tried > >setting use_rawinput to 0 to force readline, that produced an error > >when I executed cmdloop():=20 > > > >TypeError: write(): 1st arg can't be coerced to String > > Was there a stacktrace with that exception? > > It is not uncommon that TypeErrors are caused by a too > restrictive method signature in the jython core, but more > information is needed. Also try to start jython with the command: > > jython -Dpython.options.showJavaExceptions=true > > to get additional stacktrace information. > > >Does anyone have any ideas how readline can be made to work > in cmd.Cmd > >interpreters? > > I doubt that it works at the moment. raw_input() just call the > .readline() method on sys.stdin. > > Someone have to add support for readline in __builtin__.raw_input(). > > Anyone? > > regards, > finn > > > |