Artur Castiel
Artur Castiel

Reputation: 185

Subprocess Call in Python 3

Hey guys I have a pretty simple code.

subprocess.call(dirIFLO+'IFLO.exe')

Where dirIFLO is just a folder above the current working directory This code is suppose to run IFLO.exe while my code waits. The program does start but somehow it does not manage to get the files they were suppose to in the same directory it is. If I manually open it I get it working just fine.

Upvotes: 0

Views: 260

Answers (1)

Artur Castiel
Artur Castiel

Reputation: 185

I have managed to make it work by accessing the subdirectory and calling the program instead of opening the subroutine straight from the working directory.

w = os.getcwd()
os.chdir(dirIFLO[:-2])
subprocess.call('IFLO.exe')
os.chdir(w)

Upvotes: 0

Related Questions