I am using os.system to execute a java program through a python script. I need to pass a file name to the java program as an argument. I am not able to figure out how to pass the relative file location. What should be my reference for determining the relative location. I tried to use the location of the python script as the reference but doesn't work.
asked Sep 22, 2009 at 14:55
Anand
1 Answer 1
See the subprocess module for all your external process invoking needs.
p = subprocess.Popen(['myjavaapp', 'afilename.txt'])
If you need to get the relative location and you aren't sure how the other command is going to take it, make it absolute.
p = subprocess.Popen(['myjavaapp', os.path.abspath('afilename.txt')])
answered Sep 22, 2009 at 14:59
ironfroggy
8,1357 gold badges38 silver badges45 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default