Jul-27-2021, 01:20 PM
I guess you're running your tool in a different directory and Python is searing at the wrong places.
If your Program have to be stated inside the program directory, you can tell this subprocess to do.
import subprocess from pathlib import Path script_dir = Path(__file__).parent jar_file = script_dir / "XYZ.jar" subprocess.call(["echo", "Path", jar_file.absolute()])
Quote:Changed in version 3.6: args parameter accepts a path-like object if shell is False and a sequence containing path-like objects on POSIX.
Changed in version 3.8: args parameter accepts a path-like object if shell is False and a sequence containing bytes and path-like objects on Windows.
If your Program have to be stated inside the program directory, you can tell this subprocess to do.
# will print /var subprocess.call(["pwd"], cwd="/var")
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!