RE: [Python-Dev] ConfigParser patches
At 11:43 PM 10/2/2004, python-dev-request@python.org wrote:
Date: Sat, 2 Oct 2004 21:14:07 -0400 From: "Raymond Hettinger"
Subject: RE: [Python-Dev] ConfigParser patches To: Cc: python-dev@python.org Message-ID: <000801c4a8e6$6217fc20$e841fea9@oemcomputer> Content-Type: text/plain; charset="us-ascii" I was in fact thinking of the -m proposal when I wrote that...
The timing does suck.
It's so easy to define an alias or use a one-line shell script for invoking Python with a full pathname that I'm really not sure I like the -m idea,
My understanding was that it wasn't about a full pathname to python, it was about searching sys.path for the darned script so us poor Windows guys don't have to change directories a million times a day (no aliases or shebangs for us either).
I have a big pile of batch files just to invoke timeit, texchecker, profile, etc. It bites the big one.
Am I missing something? I run python scripts all the time from the command line in Windows. Modify your PATHEXT environment variable: PATHEXT=.PY;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH Then put your script directory into your PATH: PATH=C:\Python23\lib;%PATH% The first time you run timeit (or whatever.py), Windows will prompt you to associate the .py extension with a program. Pick your favorite python.exe. You can also do this manually before running your script. From then on, you're set: C:\>timeit -s "a=range(20)" "a.append(1)" "a.pop()" 1000000 loops, best of 3: 1.13 usec per loop --dang p.s. You can put .pyc in your path too, but then you'll get the compiled version even if the uncompiled version is newer. But you can always compile them.
Modify your PATHEXT environment variable:
PATHEXT=.PY;.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
... You can put .pyc in your path too, but then you'll get the compiled version even if the uncompiled version is newer. But you can always compile them.
Or you can put .pyc _after_ .py on your PATHEXT and then the .py will always get picked up first for Python to decide whether the .pyc can be used. If there is only a .pyc around then it will get picked up. PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl;.py;.pyw;.pyc;.pyo;.pys Trent -- Trent Mick trentm@activestate.com
participants (2)
-
Daniel 'Dang' Griffith
-
Trent Mick