[Python-ideas] Option of running shell/console commands inside the REPL
Oleg Broytman
phd at phdru.name
Sat Feb 2 08:24:16 EST 2019
On Sat, Feb 02, 2019 at 03:37:36PM +1100, Steven D'Aprano <steve at pearwood.info> wrote:
> Sorry, I was not as clear as I ought to have been:
>
> On Sat, Feb 02, 2019 at 02:10:06PM +1100, Steven D'Aprano wrote:
>
> > > * Clear separation (using, for example, different colors)
> > > between input, output and errors;
> >
> > Input always starts with a prompt; exception tracebacks always start
> > with the line "Traceback..."; other errors are generally not
> > programmatically distinguishable from non-errors.
>
> By which I mean, if a script or module reports an error by just printing
> a message to the screen:
>
> print("sorry, an error occurred")
>
> sort of thing. Obviously the interpreter cannot guess which messages
> represent errors in that sense and which are non-error output.
>
> (Of course, a script could format its own error messages, say by using
> terminal-specific colour codes.)
Scripts that report errors this way are broken and must be fixed:
print("sorry, an error occurred", file=sys.stderr)
Now it's easy to separate normal output from errors and colorize them
differently.
> --
> Steve
Oleg.
--
Oleg Broytman https://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list