Unable to access jarfile using subprocess

2019-06-11 22:54发布

问题:

I am trying to run a Java command in python like this:

import subprocess

subprocess.Popen(['java -Xmx1024m -jar /maui-standalone-1.1-SNAPSHOT.jar run /data/models/term_assignment_model -v /data/vocabulary/nyt_descriptors.rdf.gz -f skos'], cwd=r'/Users/username/Repositories/RAKE-tutorial/', shell=True)

Unfortunately it is throwing an Unable to access jarfile /maui-standalone-1.1-SNAPSHOT.jar error. I have checked the permissions and tried a number of other options including using the os.system command to run a shell script. The error still remains. There seem to be a lot of people who have encountered the same problem but none of their solutions seem to work for me. Any suggestions? Let me know if you need any more information. Thanks in advance!