我一直在嘗試使用git-p4 python腳本將git p4庫路徑導入git。 配置我的環境之後(GIT 1.7.1,Python 2.7版,在Windwos XP,P4 ENV變量),我試圖運行 git的-P4腳本,geetting以下ouptut:無法使用git-p4在windows上導入
F:\gitp4>c:\Python27\python.exe git-p4.py clone --destination=master //depot/quake/main/[email protected]
Reading pipe: git config git-p4.syncFromOrigin
Importing from //depot/quake/main/[email protected] into master
Initialized empty Git repository in F:/gitp4/master/.git/
Traceback (most recent call last):
File "git-p4.py", line 1926, in <module>
main()
File "git-p4.py", line 1921, in main
if not cmd.run(args):
File "git-p4.py", line 1798, in run
if not P4Sync.run(self, depotPaths):
File "git-p4.py", line 1501, in run
self.hasOrigin = originP4BranchesExist()
File "git-p4.py", line 439, in originP4BranchesExist
return gitBranchExists("origin") or gitBranchExists("origin/p4") or gitBranchExists("origin/p4/master")
File "git-p4.py", line 332, in gitBranchExists
stderr=subprocess.PIPE, stdout=subprocess.PIPE);
File "c:\Python27\lib\subprocess.py", line 672, in __init__
errread, errwrite)
File "c:\Python27\lib\subprocess.py", line 882, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
有誰知道這是怎麼回事這裏?如果我嘗試從命令行shell運行第332行的git命令(git rev-parse origin),則該命令將被正確執行。
謝謝。
更新:似乎腳本無法啓動其exec文件不在執行路徑中的任何進程。 我認爲這是一個初始化問題在Windows蟒蛇...
似乎subprocess.Popen([「git」] ...)的用法忽略PATH變量。我有一個解決方法,即調用一個全路徑批處理文件,該文件調用git exec文件 – Tate 2011-03-17 13:53:26
謝謝,這對我很有用。 – Kevin 2011-04-21 22:44:53
你能否澄清你到底做了什麼,我無法得到它的工作:( – Restuta 2011-12-19 06:35:20