[IPython-dev] rehash on Win*

Daniel 'Dang' Griffith pythondev-dang at lazytwinacres.net
Thu Jun 24 09:15:22 EDT 2004

   >  > In particular, @rehash/x are very Unix-specific.  I don't know how to
   >  deal
   >  > with $PATH and how to make executability decisions under Windows,
   >  which (I
   >  > think) has a baroque extension-based mechanism for this.  If someone else
   >  Why don't you just make some well-known extensions executable? exe, bat,
   >  cmd, py, pl? It's much better than nothing, and works for 99% of the cases.

You can get the extensions from os.environ['pathext']:

In [27]: import os
In [28]: print os.environ['pathext'].split(';')
['.PYC', '.PY', '.COM', '.EXE', '.BAT', '.CMD', '.VBS', '.VBE', '.JS', '.JSE', '.WSF', '.WSH']

This list is in the order that the shell searches for them.  (I've added pyc and py
to mine, so I can run python scripts without entering an extension (and regularly
reconsider whether I should have pyc before or after py).)

I've not had a chance to look at rehash, yet, but something else that might matter
is that the Win* shell is not case sensitive, so python.exe and PYTHON.EXE can
both be executed by entering either upper or lowercase 'python'.


More information about the IPython-dev mailing list