[issue45721] Improve error message when python shell command is entered at the REPL prompt

2021-11-05 Thread Alex Waygood


Alex Waygood  added the comment:

+1 for adding r"pip\s" as a special case as well. A few months ago, I was 
trying to (remotely) help a beginner friend debug why his attempt to install a 
library wasn't working. It took me ages before I realised he was entering it 
into the interactive REPL rather than a terminal window.

--
nosy: +AlexWaygood

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45721] Improve error message when python shell command is entered at the REPL prompt

2021-11-05 Thread Andre Roberge


Andre Roberge  added the comment:

I think that "trying to run a shell command" might not be easy to understand by 
a beginner.

If the special case of r"python\s+" is added, perhaps r"pip\s+" should be 
considered as well since many sites on the Internet suggest to install packages 
using "pip install ..." instead of "python -m pip install ..."

--
nosy: +aroberge

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45721] Improve error message when python shell command is entered at the REPL prompt

2021-11-04 Thread Steven D'Aprano


New submission from Steven D'Aprano :

A frequent newbie mistake is to call shell commands from inside the interactive 
interpreter. Most common is to call Python itself.

Here is an example where a Python instructor was allegedly unable to diagnose 
the issue for their students:

https://windowsquestions.com/2021/10/09/syntaxerror-invalid-syntax-perhaps-you-forgot-a-comma/


I think it would be a nice feature if the compiler recognised obvious cases of 
"user tried to call Python from the Python prompt", and suggested a fix. If the 
statement matches the regex r"python\s+" the error message might say "it looks 
like you are trying to run a shell command at the Python prompt" rather than 
suggest a missing comma.

--
messages: 405764
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: Improve error message when python shell command is entered at the REPL 
prompt
type: enhancement
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com