I have Python 3.1, Subversion 1.6.12, and PySVN installed on Windows XP.
If I open a Python terminal and do
import subprocess
print subprocess.check_output(['svnlook','youngest','D:/svn-repos/myrepo'])
I get the expected revision number.
However, if I add this to Subversion's post-commit.bat, it fails with the error "The handle is invalid":
File "C:\Program Files\Python31\lib\subprocess.py", line 472, in check_output
process = Popen(*popenargs, stdout=PIPE, **kwargs)
File "C:\Program Files\Python31\lib\subprocess.py", line 651, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\Program Files\Python31\lib\subprocess.py", line 750, in _get_handles
p2cread = GetStdHandle(STD_INPUT_HANDLE)
WindowsError: [Error 6] The handle is invalid
What could be causing this, and how would I fix it? I tried changing the Subversion service to run as my user, thinking it was some sort of permissions issue with the default systems account, but that had no effect.
Assuming there's no direct fix for this, how would I work around this? I need some way to retrieve the youngest revision number from a SVN repository without have a local working copy. I've dug through PySVN's Programmer's Reference, but I can't find the equivalent call to "svnlook youngest".
Edit: I'm calling the script from the post-commit.bat like:
@ECHO OFF
"C:\Program Files\Python31\python.exe" "D:\svn-repos\myrepo\hooks\myscript.py"