Re: Interactive mode not very useful



Sal wrote:
I'm running PHP 5.2.6 on WindowsXP. When I try interactive mode with
">php -a" the slightest syntax error throws me out of the interpreter
and back to the command line. This is not very useful. Isn't there a
way to stay in interactive mode after a syntax error?

Not really. But then if you have a syntax error, your code can't be executed anyway, so why stay in the interpreter? It would be nice if it let you correct the error, but it doesn't. That's why I seldom use the interpreter in interactive mode, and even then only for programs of a few lines.

In Windows, once you've reentered the interpreter, you can use the up/down arrow keys to scroll through the keyboard buffer. When you're in the interpreter you'll have the lines previously entered in the buffer. A bit awkward, but it does help a little.

Otherwise, I just use an editor to create a file and leave the editor window open while I test the script.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.



Relevant Pages

  • Re: a short-cut command for globals().clear() ??
    ... level python interpreter command that clears all user variables (not ... built-ins) from the global namespace. ... the same whether you are in interactive mode or not. ... very little use for a method that clears globals in general, ...
    (comp.lang.python)
  • Re: Compiler and an interpreter
    ... > error.Can anybody please tell me how the compiler and interpreter will ... As a syntax error is a parse error, ... Some compilers stop at the first syntax error. ...
    (comp.programming)
  • Re: multi-line input?
    ... Command text is captured and passed to the interpreter a single line ... In particular, compile_command tries to determine whether the entered text is a complete Python statement, contains a syntax error, or requires more input. ... If you want to stay with C code, you could use Py_CompileString and see if the already entered code can be compiled or not - but I'm not sure if you will actually be able to distinguish a SyntaxError from an incomplete statement. ...
    (comp.lang.python)
  • interpreter
    ... is it posible to run script host [cscript] in interactive mode, ... i mean, to type commands and get them executed immediately, something like ...
    (microsoft.public.scripting.vbscript)
  • Re: a short-cut command for globals().clear() ??
    ... level python interpreter command that clears all user variables (not ... built-ins) from the global namespace. ... the same whether you are in interactive mode or not. ... would we add it just so that it could be used by the interpreter. ...
    (comp.lang.python)