[Edu-sig] Re: PEPTALK: path sanity and newbie mental health

Christian Mascher christian.mascher@gmx.de
Mon, 07 Jul 2003 17:24:22 +0200


Jason Cunliffe wrote:

> PROBLEM #1
> Where to install things on Python and how to access them?
> It seems recommended default is to install modules and packages into
> Lib/site-packages/some-sub-folder.
> 
> PROBLEM#2
> But what about my personal work?
> I can find precious little advice on that..

I can recall how important it was for me to find that very information.
I think I learnt it first on Python-Tutor list. And the books don't
write much about this, true.

When I give my pupils a CD with the Python-installer on it, I also
include instructions on setting up the PYTHONPATH after the install: 
	1. create directory "C:\mypython" to put your (and my) files in
	2. edit C:\autoexec.bat with extra line "SET PYTHONPATH C:\mypython"
	3. restart computer
I'm not telling them anything about sys.path at this stage. So they just
have to follow the extra steps, to get it working. They will notice
something is wrong, when a supplied module can't be imported. 


> b) edit autoexec.bat and create a PYTHONPATH entry and then add 'jabber' to
> that.
> Yikes this seems also too far from python. It uses a syntax I am not certain
> about. I look in books and google around, but honestly it's hard to find
> just some simple example I can copy.

The solution is not too bad if you've grown up with autoexec.bat
settings (having started with DOS once, like me). For most computer
users today, including my 16 year old pupils, this is something they
have never done, never imagined one could do. I agree,
batteries-included Python could have a friendlier approach, at least
give detailed online help and instructions.


> One of the first things all beginners are taught do is save a
> "helloworld.py" file.
> It is good practice for all software to keep user files separate from system
> or application files. Better for sysadmin, maintenance and collaborative
> workflow. But, in Python at present the first problem is that creating a
> personal folder for scripts outside of the application installation which is
> visible to import statements

[... and is not in sys.path]

I agree, this is one of those annoyances, which could stop people with
not enough time on their hands to seriously give Python a try.

What I would really appreciate is an optional last stage in the
installer, in which you can customize your site, i.e. create your
private directory to add to PYTHONPATH, get to know where your
sitecustomize file is and what is in it, etc.
Then I would just have to tell my pupils
	1. check the sitecustomize-option
	2. create mypython-directory for personal and local files
	(which would be added to default sys.path automatically) 

I still would have to tell them something more than just: "run the
installer".
But this is a place you wouldn't overlook if you were looking for some
solution to your problem (which I think many Newbies encounter).

> 
> sys.path.save()
> sys.path.load()
> 
> These would both default to use a clear single file called "PYTHONPATH.py"
> created  at installation.

I think this is no bad idea. Write a PEP.

Cheers,

Christian