2011-11-06 12 views
6

Non so cosa c'è di sbagliato con la mia linea shebang:shebang non funziona

[email protected]:~/Desktop$ ./test.py 
: No such file or directory 

[email protected]:~/Desktop$ ls -l 
... 
-rwxr-xr-x 1 vic vic  35 2011-11-06 15:46 test.py 
... 

[email protected]:~/Desktop$ cat test.py 
#!/usr/bin/env python 
print('!') 

[email protected]:~/Desktop$ /usr/bin/env python 
Python 2.7.2+ (default, Oct 4 2011, 20:06:09) 
[GCC 4.6.1] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> 

Tutte le idee?

[email protected]:~/Desktop$ head -n 2 test.py|hexdump -C 
00000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 70 |#!/usr/bin/env p| 
00000010 79 74 68 6f 6e 0d 0a 0d 0a      |ython....| 
00000019 
[email protected]:~/Desktop$ 
+0

Puoi pubblicare l'output di 'head -n 2 test.py | hexdump -C' per verificare che ci siano caratteri divertenti in quella linea? – Mat

risposta

10

Il file ha terminazioni di linea di tipo Windows. Convertilo in terminazioni di linea tipo Unix appropriate e dovresti essere a posto.

$ dos2unix test.py 
Problemi correlati