[Python-ideas] from __pip__ import

אלעזר elazarg at gmail.com
Mon Sep 19 14:52:09 EDT 2016


Wow chris, that's a nice one!

Of course it doesn't  address the issues - for example, running a python
script from the file manager will result in a failed execution, unexplained.

On Mon, Sep 19, 2016 at 9:48 PM Chris Angelico <rosuav at gmail.com> wrote:

> On Tue, Sep 20, 2016 at 4:43 AM, MRAB <python at mrabarnett.plus.com> wrote:
> > On 2016-09-19 18:20, אלעזר wrote:
> >>
> >> Obviously
> >>
> >>     from __pip__ import "run-lambda>=0.1.0"
> >>
> >> Which is ugly but not my fault :)
> >>
> > [snip]
> > One possible problem I can see is that if it's quoted you might think
> that
> > it's an expression and that you could also write:
> >
> >     package = "run-lambda>=0.1.0"
> >     from __pip__ import package
>
> One surprisingly effective option is this:
>
> import blargle.spam # Solution: pip install blarg
>
> Comes out looking like this:
>
> Traceback (most recent call last):
>   File "useblarg.py", line 1, in <module>
>     import blargle.spam # Solution: pip install blarg
> ModuleNotFoundError: No module named 'blargle'
>
> (in older Pythons, that says "ImportError" rather than the more
> specific subclass, but same diff)
>
> You can put whatever you like onto that command line.
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160919/092186b9/attachment.html>


More information about the Python-ideas mailing list