Menu ▾ ▴

PYTHONPATH / how to add svn executable

2008-12-08
2013-03-15
  • Anton Shishkov

    Anton Shishkov - 2008-12-08

    Hi,

    When I run next command from terminal -> no problems:
    import subprocess

    print subprocess.Popen(["svn info"], shell=True, stdout=subprocess.PIPE).communicate()[0]

    but when I run same command from PyDev I get:
    /bin/sh: svn: command not found

    Tried putting folder:
    "/opt/subversion/bin" into PYTHONPATH but no luck. Works only if I use fullpath:
    print subprocess.Popen(["/opt/subversion/bin/svn"], shell=True, stdout=subprocess.PIPE).communicate()[0]

    Any suggestion how to fix my problem?

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2008-12-08

      Are your PATH/LIBPATH variables correct to support svn?

      Cheers,

      Fabio

       
    • Anton Shishkov

      Anton Shishkov - 2008-12-08
       
      • Fabio Zadrozny

        Fabio Zadrozny - 2008-12-08

        Hi,

        Actually, that has nothing to do with the PYTHONPATH. What it needs to find is svn at the PATH variable.

        Cheers,

        Fabio

         
        • Anton Shishkov

          Anton Shishkov - 2008-12-08

          My path looks like this:

          anton-shishkovs-macbook-pro:~ antonshishkov$ echo $PATH
          xxx:/opt/subversion/bin:xxx

           
    • Rajat

      Rajat - 2008-12-09

      Yes, Fabio is right.

      It has got nothing to do with the PYTHONPATH.
      All you have to do is (if its a Windows machine), set the PATH to location where svn.exe is kept.

      In my case (on Windows XP), my PATH is set to "C:\Program Files\Subversion\bin" and under "bin" directory I have my svn.exe kept.

      And, inside my script I simply use:

      subDirs = subprocess.Popen(["svn", "list", libPath], stdout=subprocess.PIPE)

      and this works without any problem.

      Cheers,
      Rajat

       
    • Anton Shishkov

      Anton Shishkov - 2008-12-15

      Installed blank WinXP added SVN to PATH -> same result

      Path=C:\Program Files\Subversion\bin;C:\Program Files\Java\jdk1.6.0_11/bin;C:\ma
      ven/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

      print subprocess.Popen("svn --help", stdout=subprocess.PIPE).communicate()[0]

      Traceback (most recent call last):
        File "C:\workspace\PythonTestProject\pipes\pipe_test.py", line 4, in <module>
          print subprocess.Popen("--help", executable="svn", stdout=subprocess.PIPE)
        File "C:\Python26\lib\subprocess.py", line 595, in __init__
          errread, errwrite)
        File "C:\Python26\lib\subprocess.py", line 821, in _execute_child
          startupinfo)
      WindowsError: [Error 2] The system cannot find the file specified