Message276373
A problem we're starting to see on distutils-sig is folks trying to type pip commands into the Python REPL rather than their system shell, and getting cryptic syntax errors back:
>>> pip install requests
File "<stdin>", line 1
pip install requests
^
SyntaxError: invalid syntax
>>> python -m pip install requests
File "<stdin>", line 1
python -m pip install requests
^
SyntaxError: invalid syntax
This may be amenable to a similar solution to the one we used to give a custom error message for "print ":
>>> print foo
File "<stdin>", line 1
print foo
^
SyntaxError: Missing parentheses in call to 'print'
That code currently checks for "print " and "exec ", so it would be a matter of adding another special case that looked for "pip install " appearing anywhere in the string that's failing to compile (it can't be limited to the start as it may be an attempt to invoke pip via "-m") |
|
Date |
User |
Action |
Args |
2016-09-14 04:40:03 | ncoghlan | set | recipients:
+ ncoghlan |
2016-09-14 04:40:03 | ncoghlan | set | messageid: <1473828003.51.0.301742763108.issue28140@psf.upfronthosting.co.za> |
2016-09-14 04:40:03 | ncoghlan | link | issue28140 messages |
2016-09-14 04:40:03 | ncoghlan | create | |
|