subprocess escaping POpen?!
Jean-Michel Pichavant
jeanmichel at sequans.com
Thu Aug 5 09:36:29 EDT 2010
Chris Withers wrote:
> Jean-Michel Pichavant wrote:
>> You did not redirect stdin, so it is expected you can still read
>> input from the console.
>
> Okay, so if I definitely wanted no input, what should I pass as the
> stdin parameter to the POpen constructor?
You do want an input don't you ? 'cause there is a password to enter.
from subprocess doc page:
"Note that if you want to send data to the process’s stdin, you need to
create the Popen object with stdin=PIPE."
>
>> And it looks like svn is writting the credentials prompt on stderr.
>
> ...which, as you can see from the code I posted, is piped to STDOUT,
> which is then PIPE'd through to the calling python so that
> communicate()'s return value will contain the output.
>
> As I explained, I can't reproduce this by replacing svn with a simple
> python script that writes to stderr. So, what is svn doing?
You're right, then that means than svn is writing credentials neither on
stdout nor stderr.
>
>> You may want to look at http://pysvn.tigris.org/docs/pysvn.html though.
>
> Yeah, we were using that, but found it excruciatingly painful due to
> its dependency on a subversion source install due to its c extension.
I can't argue with that.
>
> cheers,
>
> Chris
>
If you want to scriptly interract with svn or anything else, you may
look at the pexpect module.
JM
More information about the Python-list
mailing list