shebang strange thing...

Van Gale news at exultants.org
Fri Jun 20 07:30:19 EDT 2003


Gilles Lenfant wrote:
> 
> I installed a brand new linux Mandrake and I noticed a strange thing when
> using the shebang in a python script.
> 
> $ ./myscript.py
> error : interpreter not found. (!!!)

There's a very subtle bug (feature?) in bash (and maybe other shells?) 
that will generate this error if the line is terminated with a CR/LF 
pair instead of just a linefeed.

Your script came from a DOS/Windows system and the CR's weren't 
stripped.  If you copied using FTP make sure to use "text" mode.  If you 
  extracted a zip archive using the "unzip" command use "-a" to convert 
text files.

Van





More information about the Python-list mailing list