I have to call an executable file in Ubuntu… Just learned how to make this work by using subprocess.Popen in windows. Now, I need to repeat this step in Ubuntu.
I have used the following Python command:
a=subprocess.Popen("filename.exe",shell=0)
The return is
Traceback (most recent call last):
File "/untitled0.py", line 29, in <module>
a=subprocess.Popen("filename.exe",shell=0)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 8] Exec format error
If I change shell=1, there are no complaints, but no output files are generated either.
I have checked the type of this file using file filename.exe
It returned:
filename.exe: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not
stripped
So is it possible to call it using subprocess.Popen in Ubuntu?
Quickly reading the python docs, it looks like your doing the right thing, so the . How about trying to exec say /bin/false which should be a known working exe on your system. If that works, then your exe is likely wrong ( perhaps 64bit on a 32 bit system)