Hi,
At the moment a project I am working on requires me to manually go into the first script and change the CWD to whatever the directory is of the current machine I am running the script on. Fine for me but not so good for other users whom I want to run this script on to help them automate a few processes.
Is it possible to write python code so whichever is the directory the python script is initialized in automatically becomes the current working directory?
Thanks,
phil
SO Link
I found this link but no luck yet.
I've tried this code so far:
So far no go.
What am I missing?
Thanks,
Phil
At the moment a project I am working on requires me to manually go into the first script and change the CWD to whatever the directory is of the current machine I am running the script on. Fine for me but not so good for other users whom I want to run this script on to help them automate a few processes.
Is it possible to write python code so whichever is the directory the python script is initialized in automatically becomes the current working directory?
Thanks,
phil
SO Link
I found this link but no luck yet.
I've tried this code so far:
os.chdir(os.path.dirname(sys.path[0])) os.chdir(sys.path[0])and I'm also trying to use these modules within python itself to change the directory and reviewing some of the docs.
So far no go.
What am I missing?
Thanks,
Phil