pound bang (#!) problem...

Alex Martelli Alex.Martelli at think3.com
Mon Dec 27 03:20:46 EST 1999


Orlando Vazquez writes:


> and my un processed file (index.pyhtml) looks like..
>    #!./preprocessor.py
>    python rules!
> 
> If my UNIX skills serve me correctly running:
>    ./index.pyhtml
> should be the same as running:
>    ./preprocessor.py < index.pyhtml
> 
I'm getting rusty on _my_ Unix skills, but isn't #! modernly
implemented somewhat like:

	interpreterprogram /dev/fd/foobar

where the argument "names" a magical already-opened
file?  If that is what happening on your Unix dialect, you
might use the fileinput module in your interpreter program,
and transparently process either standard-input or a named
argument file -- handy.

A further concern is that I'm not sure #! works with an
interpreter-program that is identified by a _relative_ path;
you may need to make the path explicit, or use such
tricks as naming /usr/bin/env as the "interpreter" so that
it will look along your PATH for the actual program.


Alex





More information about the Python-list mailing list