python执行二进制文件_python中“无法执行二进制文件”错误

我不断收到以下错误:

$ ./test.py

-bash: ./test.py: cannot execute binary file当试图通过cygwin在python中运行以下文件时:

#!usr/bin/python

with open("input.txt") as inf:

try:

while True:

latin = inf.next().strip()

gloss = inf.next().strip()

trans = inf.next().strip()

process(latin, gloss, trans)

inf.next() # skip blank line

except StopIteration:

# reached end of file

pass

from itertools import chain

def chunk(s):

"""Split a string on whitespace or hyphens"""

return chain(*(c.split("-") for c in s.split()))

def process(latin, gloss, trans):

chunks = zip(chunk(latin), chunk(gloss))我该如何解决??

在接受以下建议之后,仍然会出现相同的错误。

如果这有帮助,我尝试了

$ python ./test.py得到了

$ python ./test.py

File "./test.py", line 1

SyntaxError: Non-ASCII character '\xff' in file ./test.py on line 1, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details

你可能感兴趣的:(python执行二进制文件)