admin管理员组文章数量:1180536
I'm attempting to run the SWAT+ model executable (swatplus-61.0.2-ifx-win_amd64-Rel.exe) from Python using the subprocess module. However, I encounter the following error when running the executable through Python:
The procedure entry point for_sop_core_quiet could not be located in the dynamic link library 'swatplus-61.0.2-ifx-win_amd64-Rel.exe'.
Interestingly, the executable runs perfectly when invoked manually from the Command Prompt, but fails when trying to execute it using subprocess in Python.
import os
import subprocess
exe_file = r"C:\Users\mcva\Desktop\swat_plus_gango - Copy\swatplus-61.0.2-ifx-win_amd64-Rel.exe"
# Attempt to run the executable using subprocess
try:
subprocess.run([exe_file], check=True)
print("SWAT+ ran successfully")
except subprocess.CalledProcessError as e:
print(f"Error while running SWAT+: {e}")
print(f"Exit Code: {e.returncode}")
print(f"Error Output: {e.stderr}")
Troubleshooting steps I've tried: Manually run the executable: The executable runs perfectly from the Command Prompt, but fails when invoked from Python. Checking paths: I verified that the path to the executable is correct. The file exists at C:\Users\mcva\Desktop\swat_plus_gango - Copy\swatplus-61.0.2-ifx-win_amd64-Rel.exe and is accessible. Error code 3221225785: The error code 3221225785 (0xc0000135) indicates a possible DLL conflict, but when running manually, this doesn't appear. Dependencies and DLLs: I confirmed that the SWAT+ executable works in a manual run, so it should have all the necessary dependencies. Running executable from Python: When trying to run the executable via Python’s subprocess.run() function, I encounter the error mentioned above. The output is not informative: it just mentions that the entry point for for_sop_core_quiet is missing.What I need help with: Why does SWAT+ run manually but not when invoked via Python? How can I resolve the for_sop_core_quiet entry point issue when running via Python? Are there any environment setup steps or configuration tweaks needed for running SWAT+ from Python? How can I ensure that all necessary DLLs or dependencies are correctly loaded when running from Python? Any insights or suggestions would be greatly appreciated!
本文标签: Alternatives to run a exe file with pythonStack Overflow
版权声明:本文标题:Alternatives to run a .exe file with python - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738158949a2066507.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论