subprocess svn checkout password issue

Martin De Kauwe mdekauwe at gmail.com
Fri Mar 15 18:17:22 EDT 2019


Hi,

I'm trying to write a script that will make a checkout from a svn repo and build the result for the user. However, when I attempt to interface with the shell it asks the user for their filename and I don't know how to capture this with my implementation. 

user = "XXX578"
root="https://trac.nci.org.au/svn/cable"
repo_name = "CMIP6-MOSRS"

cmd = "svn checkout %s/branches/Users/%s/%s" % (root, user, repo_name)
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
                                      stdout=subprocess.PIPE, stderr=subprocess.PIPE)
error = subprocess.call(cmd, shell=True)
if error is 1:
    raise("Error downloading repo"

I tried adding .wait(timeout=60) to the subprocess.Popen command but that didn't work.

Any advice on whether there is an augmentation to the above, or a better approach, would be much appreciated. I need to solve this with standard python libs as I'm trying to make this as simple as possible for the user.

The full script is here if that helps:

https://github.com/mdekauwe/CABLE_benchmarking/blob/master/scripts/get_cable.py

Thanks



More information about the Python-list mailing list