import path, script path (was Re: module path)

Mike C. Fletcher mcfletch at rogers.com
Fri Dec 28 23:18:05 EST 2001


Here's what I do for setup... (the first two are normally done by the 
installer, just here for info)

assoc .py=Python.File
ftype Python.File=C:\bin\lang\py22\python.exe "%1" %*


The key settings...

PATHEXT=.PY;.COM;.EXE;.BAT;.CMD;.WSH
PATH=p:\;C:\bin\lang\py22\python.exe;...

Where PATHEXT makes it possible to treat any file with that extension as 
an executable when looking for commands.  Thus the script setup.py in 
the local directory (or on the path) will be found _before_ setup.exe 
when you type:

	setup install

Adding your python scripting/setup directory as your first path entry 
means you can drop scripts in there to override commands/provide 
commands anywhere in your file-system.


Combine that with a registry key from this .reg file:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"EnableExtensions"=dword:00000001
"PathCompletionChar"=dword:00000009


And you have a fairly usable command-processor with 
file-completion-on-tab-key and the ability to just type the base name of 
python scripts stored in any directory on your path.

Enjoy all,
Mike


David Brady wrote:

...

> I am running Win9x, Win2k, and WinXP, and have
> JPSoft's excellent 4Dos and 4NT products for them.  In
> them, if you can make python scripts executable by
> typing
> 
> set .py=c:\Python21\Python.exe
> set .pyw=c:\Python21\Python.exe
...

> I have been told that the standard Windows cmd shell
> will do it for you as well, but I don't know how or
> where.

...
_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/






More information about the Python-list mailing list