Tuesday, July 26, 2011

不能執行python script

從同事那拿到一個python script
而發現他跑這個script時都是
$>python test.py

想說 那我在最前面加個 #! /usr/bin/env python
然後$>chmod a+x test.py
所以我只要 $>./test.py就好了

但竟然.......
line 1: #!: command not found

最後用file來看看這個script
$>file test.py
test.py: UTF-8 Unicode (with BOM) Java program text, with CRLF line terminators

最後把內容copy到另一個新的test1.py
test1.py: UTF-8 Unicode (with BOM) Java program text, with CRLF line terminators

就好了........................................................

No comments: