Martin De Kauwe <mdeka...@gmail.com> writes:

> 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.

That is non-trivial.

Read the "svn" documentation. You might be able to pass in the
required information by other means, maybe an option, maybe
an envvar, maybe via a configuration file.

Otherwise, you must monitor what it written to the subprocess'
"stdout" and "stderr", recognized the interaction request
perform the interaction with the user and send the result
to the subprocess' stdin.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to