【发布时间】:2011-05-02 07:41:17
【问题描述】:
我正在尝试使用 Fabric 和 Mercurial 部署我的网站。在 Windows 命令行中,运行 hg push 可以完美运行,没有任何问题。
但是当我尝试写作时
local("hg push")
在一个 fabfile 中并运行它,我得到了错误:
'"hg push"' is not recognized as an internal or external command, operable program or batch file.
谷歌搜索让我知道这可能是 Python 子进程中的 PATH 变量有问题,例如这里:Why would an "command not recognized" error occur only when a window is populated?。
你能帮帮我吗?是 Fabric 中的错误还是我自己的代码中的错误?
谢谢。
【问题讨论】:
-
Fabric 目前在 Windows 上没有得到很好的支持,所以看到这种情况我并不感到惊讶。如果您请提供一些额外的细节,可能会做得更好;使用“with show('everything', 'debug'):”添加调试日志,并包含 PATH 的内容。此外,包括您当时拥有的所有“环境”设置。
-
Chris R:我仍然不确定问题出在哪里。将所有内容放入
show('everything','debug')并没有透露有关该问题的更多信息。我尝试直接设置env.path,得到了如下所述的奇怪结果。将 local() 更改为os.system()解决了这个问题,尤其是对于像hg push这样的简单命令。
标签: windows mercurial path fabric