Bad interpreter

Benjamin Niemann b.niemann at betternet.de
Wed May 26 08:57:09 EDT 2004


Peter Hansen wrote:
> BaBS wrote:
> 
>> I've a problem whith my python script,
>>  i chmod'ed it to +x, addes the line :
>> #!/usr/bin/python2.3
>> and i verified that /usr/bin/python2.3 exists
>> but i've something like : bad interpreter: No such file or dir ...
>>
>> What's the matter ??
> 
> 
> Remove the hidden CR character which you got at the end of the
> lines by moving the file to a Windows system and editing it. ;-)
> 
> This one is pretty tricky to figure out the first few times...
Should be the other way 'round: If you edit the file under Windows (e.g. 
with Notepad), (invisible) CRs are added. Use a windows editor that 
supports "Unix" lineendings (e.g. UltraEdit: File->Conversions->DOS to 
UNIX).
One way to fix this on a Linux/UNIX system would be:
tr -d '[\r]' <script.py >fixed_script.py



More information about the Python-list mailing list