May-25-2019, 04:36 PM
Hi,
I am working with source control software which has a python API.
I want to be able to create a new dir and then populate code from the database to that dir, termed a 'client' by the SC software.
The source control software has an interesting 'feature' that it can create a new 'client' in any location however the command to do that MUST be run from an existing client. So, to try to get around this ridiculous restriction, my idea was run the following python from the <new_dir> location:
If the above example isn't clear I expect what I am asking is equivalent to running the following code from dir1 and ending up in dir2:
dir1> python change_dir.py
where change_dir.py consists of
Thanks,
Usjes.
I am working with source control software which has a python API.
I want to be able to create a new dir and then populate code from the database to that dir, termed a 'client' by the SC software.
The source control software has an interesting 'feature' that it can create a new 'client' in any location however the command to do that MUST be run from an existing client. So, to try to get around this ridiculous restriction, my idea was run the following python from the <new_dir> location:
import os import SC # source control API module os.chdir('<existing_client_dir>') SC.create_new_client('<new_dir_location>') os.chdir('<new_dir_location>') # Mission accomplished !The problem however is that the call to SC.create_new_client('<new_dir_location>') fails becasue it acts as though it was invoked from <new_dir> despite the preceeding os.chdir('<existing_client_dir>') command. So is there any way to really 'move' the execution of subsequent commands to a new dir ?
If the above example isn't clear I expect what I am asking is equivalent to running the following code from dir1 and ending up in dir2:
dir1> python change_dir.py
where change_dir.py consists of
import os os.chdir('dir2')Any ideas ?
Thanks,
Usjes.