I keep getting the following error:
$ ./test.py
-bash: ./test.py: cannot execute binary file
when trying to run the following file in python via cygwin:
#!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))
How do I fix this??
After taking on the below suggestions, still getting the same error.
If this helps, I tried
$ python ./test.py
and got
$ 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
How to Fix ‘cannot execute binary file: Exec format error’ on Ubuntu. If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption.
Rather, this is simply because the compiled microprocessor opcode inside of the binary is so alien to your system that it doesn’t know how to interpret some of the code. The best way to fix this is to install the proper package for your architecture.
If you've downloaded a binary and executing it fails with this error, check if you've downloaded the version for the wrong OS. Show activity on this post. For me, copying the binary into Applications on my Mac then into my Path messed it up on my Mac.
The command your container is running is probably something like So bash finds a python in its $PATH (successfully), and tries to run it as a shell script (leading to that error). You don't strictly need an ENTRYPOINT, and here it's causing trouble.
There is a problem. You are missing the '/' in front of usr in #!usr/bin/python
. Your line should look like this.
#!/usr/bin/python
In addition to protecting the file executable, #!/usr/bin/python
may not work. At least it has never worked for me on Red Hat or Ubuntu Linux. Instead, I have put this in my Python files:
#!/usr/bin/env python
I don't know how this works on Windows platforms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With