W Subversion documentation jest przykładem użycia Subversion z PythonemPython Subversion wrapper library
#!/usr/bin/python
import svn.fs, svn.core, svn.repos
def crawl_filesystem_dir(root, directory):
"""Recursively crawl DIRECTORY under ROOT in the filesystem, and return a list of all the paths at or below DIRECTORY."""
# Get the directory entries for DIRECTORY.
entries = svn.fs.svn_fs_dir_entries(root, directory)
Gdy ten kod pojawia się błąd importowania:
$ python crawl.py
Traceback (most recent call last):
File "crawl.py", line 7, in <module>
import svn.fs, svn.core, svn.repos
ImportError: No module named svn.fs
Oznacza to jestem brakuje biblioteka svn
. Próbowałem zainstalować pakiet, ale menedżer pakietów Pythona nie może go znaleźć.
$ pip install svn
Downloading/unpacking svn
Could not find any downloads that satisfy the requirement svn
No distributions at all found for svn
Jak zainstalować tę bibliotekę?
Czy to nie jest trochę dziwne, że narzeka 'svn.core' ale nie o' svn.fs' (ta ostatnia jest pierwsza na liście importu)? – NPE
Złapałeś mnie, skopiowałem i wkleiłem błąd, uruchamiając 'import svn.core' w interaktywnym pytaniu –