This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients ncoghlan
Date 2016-09-14.04:40:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473828003.51.0.301742763108.issue28140@psf.upfronthosting.co.za>
In-reply-to
Content
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")
History
Date User Action Args
2016-09-14 04:40:03ncoghlansetrecipients: + ncoghlan
2016-09-14 04:40:03ncoghlansetmessageid: <1473828003.51.0.301742763108.issue28140@psf.upfronthosting.co.za>
2016-09-14 04:40:03ncoghlanlinkissue28140 messages
2016-09-14 04:40:03ncoghlancreate