0

I am calling an exe (which is dependent on other batch files) , Python is giving error. I am able to call exe (which is independent)

what I am doing is..

import os
os.system("notepad.exe")    # is working

but

os.system("c:/ank.exe")     # this is giving error as ank.exe is dependent on other batch     files
1
  • 1
    What error? More details please. Commented Oct 9, 2011 at 17:30

1 Answer 1

5

you have to first change the current directory so that the executable you want to run can find its dependencies:

target = "c:/ank.exe"
os.chdir(os.path.dirname(target))
os.system(target)

otherwise, os.system() executes in the directory of the running script.

Sign up to request clarification or add additional context in comments.

1 Comment

I did that still os.system is returning 1, and no output is getting displayed.. Actually I am calling OpenEv.exe(converted openEV batch file to exe) and the path for that is target = "C:/Program Files/FWTools2.4.7/openev.exe" and the rest of the steps as same as you have mentioned still i doesn't work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.