On Wed, 20 Feb 2002 12:15:11 -0600
Brian Ericson <bm...@vi...> wrote:
> Anyone tried ":" (compound statements) with Bablok's readline (version
> 0.7.0 on Linux)? Esc-Tab over Tab will take a little getting used to
> (especially since Tab itself in readline isn't all that useful), but
> readline apparently doesn't like the last blank line needed to terminate
> the statement...
>
> >>> if 1:
> ... print 1
> ...
> Traceback (innermost last):
> (no code object) at line 0
> File "<console>", line 3
> null
> ^
> SyntaxError: invalid syntax
> >>>
>
> Is this a known issue? Is there a workaround? I don't want to go back...
>
>
Hi,
I got the same annoying error using the readline library.
I patched the ReadlineConsole.java which comes with the lib (contrib)
as follows to get around.
(Beside this, the library is rellay great!)
/**
* Write a prompt and read a line.
*
* The returned line does not include the trailing newline. When the
* user enters the EOF key sequence, EOFError is raised.
*
* This subclass implements the functionality using JavaReadline.
**/
35 public String raw_input(PyObject prompt) {
36 try {
37 String line = Readline.readline(prompt.toString());
38 return (line == null ? "" : line);
39 } catch (java.io.EOFException eofe) {
40 throw new PyException(Py.EOFError);
41 } catch (java.io.UnsupportedEncodingException e) {
42 throw new PyException();
43 }
44 }
Note the differences at lines 37,38
It works for me.
Hope this helps.
--Stefan
> _______________________________________________
> Jython-users mailing list
> Jyt...@li...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
|