0

I am trying to run a python script to run other python scripts.

The problem is that the other scripts I am trying to run are in a diffrent directory. And in those other python scripts it uses the os.getcwd() function as well.

When the other scripts runs, it gets the working directory path via os.getcwd() function. returns the current directory of the first orgin script that executed the other scripts

Im running the like this:

os.system("python "+ os.getcwd()+r"\BDJCOMPUTERREPAIR\poster1-1.py")
Jerzyk
  • 3,662
  • 23
  • 40
  • 1
    Does this help? http://stackoverflow.com/questions/5137497/find-current-directory-and-files-directory – goelakash Jun 28 '16 at 17:50
  • `os.getcwd()` is actually the directory from which you ran the first script. It is not necessarily the directory where even the first script is located. Also, look at `subprocess` module better ways to run separate processes. – Mad Physicist Jun 28 '16 at 17:56
  • Thank you very much Mad Physicist and thank you Goelakash.Geolakash the thing you mention does work but i need to edit alot of code. Thankyou for advice it was very helpul. – David Gonzalez Jun 28 '16 at 17:59

0 Answers0