[Python-ideas] "import me" to display some summary of the current python installation

Steven D'Aprano steve at pearwood.info
Tue Apr 11 23:18:42 EDT 2017


On Wed, Apr 12, 2017 at 09:56:40AM +0800, Kamal Mustafa wrote:

> On the same theme with "import this" and "import antigravity", "import
> me" I think can be both some fun way to introduce Python and also
> offer a helpful functionality when troubleshooting python installation
> with someone new to the language.

If your Python installation isn't working, how are you supposed to run 
"import me"?

You're a bit vague about what this "import me" is actually going to do. 
Can you show a mock-up of the output you expect?

Both import this and antigravity are Easter eggs. I'm not entirely sure 
I like the idea of having a non-joke module run as a script on import. 
At the very least, it makes testing harder.

But having said that, I like the idea of a standard, simple way of 
getting a good set of diagnostic information.


> Currently, we have to use some myriad approach like "show me the
> output of `which python`" to know the basic info of the python
> installation someone having trouble or asking question.

What's wrong with that? Apart from not working on Windows.

If you are trouble-shooting calling Python from the shell, you need to 
see what the shell thinks is your Python executable, which may be an 
alias. For example, I might have:

[steve at ando ~]$ which python3.5
alias python3.5='env -u PYTHONSTARTUP python3.5'
        /usr/bin/env

Now, if I forget and wonder why Python 3.5 doesn't run my startup file, 
I can't troubleshoot that from inside Python 3.5 since the problem is in 
the shell, not Python.


-- 
Steve


More information about the Python-ideas mailing list