pjmyburg
pjmyburg

Reputation: 182

SVN hook environment issues with Python script

I am experiencing issues with my SVN post-commit hook and the fact that it is executed with an empty environment. Everything was working fine till about two weeks ago when my systems administrator upgraded a few things on the server.

My post-commit hook executes a Python script that uses a SVN module to email information about the commit to me. After the recent upgrades, however, Python cannot find the SVN module when executed via the hook. When executed by hand (ie with all environment variables intact) everything works fine.

I have tried setting the PYTHONPATH variable in my post-commit hook directly (PYTHONPATH=/usr/local/lib/svn-python), but that makes no difference.

How can I tell Python where the module is located?

Upvotes: 1

Views: 456

Answers (2)

pjmyburg
pjmyburg

Reputation: 182

Got it! I missed the export in my post-commit hook script! It should have been:

export PYTHONPATH=/usr/local/lib/svn-python

Problem solved :)

Upvotes: 1

kharakawa
kharakawa

Reputation: 11

Your system administrator might have forgotten to execute this command.

echo /usr/local/lib/svn-python \
> /usr/local/lib/python2.x/site-packages/subversion.pth

This is written in subversion/bindings/swig/INSTALL in the source distribution.

Upvotes: 1

Related Questions