Reputation:
I am trying to run a .exe file on Windows 10, by calling it inside of a Python 3.8 script with subprocess. I want to execute everything on Cygwin.
The following is my Python function doing that:
os.chdir(r"c:\cygwin64\bin")
cmd = ["bash", "-c", 'cd "C:/Users/usr/file"; ./myexefile']
subprocess.call(cmd)
This will give me the error
C:/Users/usr/file/myexefile.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
While I was trying to figure out, what is the problem,
I read some solutions of that specific error, in other contexts, saying one is supposed to change path variables, but as the function call works within Cygwin, I don't think this works.
I hope someone can help me, I'm very new to this topic.
EDIT: I also discovered, that the command "ls" does not work. "cd", "pwd" do work.
Upvotes: 0
Views: 493
Reputation:
Solved: I fixed it with adding C:/cygwin64/bin
to the Path
variable.
Upvotes: 1
Reputation: 8486
This looks like a Windows python trying to run a Cygwin shell
os.chdir(r"c:\cygwin64\bin")
cmd = ["bash", "-c", 'cd "C:/Users/usr/file"; ./myexefile']
subprocess.call(cmd)
assuming that myexefile
is a Cygwin program, as the bash is not run with login option
the PATH is not correctly set and the needed shared lib are not found.
If you need to know which DLLs are needed for a program or shared lib:
$ objdump -x octave-5.2.0.exe |grep "DLL Name:"
DLL Name: cygwin1.dll
DLL Name: cygX11-6.dll
DLL Name: cyggcc_s-seh-1.dll
DLL Name: cygstdc++-6.dll
DLL Name: KERNEL32.dll
Upvotes: 0