[Python-Dev] Python install layout and the PATH on win32

VanL van.lindberg at gmail.com
Tue Mar 20 17:02:27 CET 2012


On 3/20/2012 10:52 AM, "Martin v. Löwis" wrote:
>> In hearing from a couple people who teach python to beginners, this is a
>> substantial hurdle - the first thing they need to do is to edit their
>> environment to add these directories to the PATH.
> This is something I never understood. On Windows, it's custom to launch
> programs from the start menu, and Python is easy enough to find on the
> start menu (e.g. by typing "Python"). Why do people want to launch it by
> opening a shell window, then typing python?

Because the workflow you suggest is broken when you are developing with 
Python. Assume that you are iteratively building up a program in Python. 
You aren't sure if it is right yet, so you want to get it into python to 
test it and see the output. There are three ways to do this.

1. Run python from the start menu.
- Import sys, fiddle with sys.path to add my module, import/run my 
module, do my tests. When you exit /hard error out, the python window 
disappears.

2. Double-click the .py file
- Runs the file, but then disappears immediately (unless you put in 
something like input/raw_input just to keep the window open) - and if it 
errors out, you never see the traceback - it disappears too fast.

3. Get a shell and run python.
This requires cd'ing to the directory where my .py file is, but then I 
run/import it and I see the information. To repeat the process, either 
type python again or just press arrow-up.

4. (Not relevant here) - do it in an IDE that does #3 for you.

#3 is the only reasonable way to do development if you are not in an IDE.

Thanks,
Van


More information about the Python-Dev mailing list