0

I am trying to utilise mailer.py script to send mails after a SVN Commit. In mailer.py svn module has been used. I think the svn module is present in /opt/CollabNet_Subversion/lib-146/svn-python/svn and I tried to append it to the sys path using sys.path.append. For once it is getting appended and when I do sys.path I can see the appended path but after that the path is removed and I am getting import error: No Module named SVN.

Am I missing something?

5
  • can you post the relevant parts of your code please Commented Nov 3, 2015 at 7:04
  • You can adjust your PATH variable by adding PATH=$PATH:/mypath to your ~/.bashrc .. That will append your custom path to the variable whenever ~/.bashrc is executed (such as a new terminal session or when source ~/.bashrc is called) Commented Nov 3, 2015 at 7:12
  • This is in mailer.py sys.path.append('/opt/CollabNet_Subversion/lib-146/svn-python/svn') sys.path.append('/opt/CollabNet_Subversion/lib-146/svn-python/libsvn') import svn.delta import svn.repos import sv.fs import svn.core This is the error I am getting while trying to commit: File "/data/svn/repos/hook-scripts/mailer/mailer.py", line 46, in ? import svn.delta ImportError: No module named svn.delta Commented Nov 3, 2015 at 7:52
  • Inside /opt/CollabNet_Subversion/lib-146/svn-python/svn folder I have core.py,delta.py,repos.py and fs.py Inside /opt/CollabNet_Subversion/lib-146/svn-python/libsvn folder there are .so and .pyc and .la files Commented Nov 3, 2015 at 7:52
  • Not an answer to your specific question as worded, but as you continue to use python, I'd encourage you to look into virtualenv as that may simplify things a bit (as you can install svn etc. to your virtualenv and not need to worry about root etc.) Commented Nov 3, 2015 at 12:37

1 Answer 1

1

Like setting environment variable in bash, if you close session it will be disapear.

So just add sys.path.append it will add path in runtime.

Sign up to request clarification or add additional context in comments.

1 Comment

I appended the path in mailer.py itself but still I am getting no module named svn error while trying to commit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.