Windows 上的 Fabfile 路径问题
我正在尝试使用 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
变量的问题,例如这里:为什么“命令无法识别” “错误仅在填充窗口时发生?。
你能帮我一下吗?是 Fabric 中的错误还是我自己的代码中的错误?
谢谢。
I'm trying to deploy my site using Fabric and Mercurial. In the Windows command line, running hg push
works perfectly with no problems.
But when I try writing
local("hg push")
in a fabfile and running it, I get the error:
'"hg push"' is not recognized as an internal or external command, operable program or batch file.
Googling gave me an idea that it might be a problem with the PATH
variable in Python subprocesses, for example here: Why would an "command not recognized" error occur only when a window is populated?.
Can you help me out? Is the bug in Fabric or in my own code?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
听起来您需要将 Mercurial 添加到 Fabric 进程的
PATH
中。也许是这样的:
请参阅 的文档路径上下文管理器。目前尚不清楚
path
是否适用于local
命令,但明确引用了run
命令。It sounds like the you need to add Mercurial to the Fabric process's
PATH
.Maybe something like:
See the docs for the path context manager. It wasn't clear if
path
applies tolocal
commands, butrun
commands are explicitly referenced.提供的修复均无效,但更改
local("hg Push")
来
解决问题。
Neither of the fixes provided worked, but changing
local("hg push")
to
solved the problem.
正如 Chris R 提到的,我们没有提供大量的 Windows 支持,因为核心开发人员都不是 Windows 用户;我们必须依赖更精明的 Windows 用户的报告和建议。
听起来这可能与这个最近修复但未发布的错误有关 -它将出现在 Fabric 1.0.2 中,很快就会发布。如果您有勇气,现在可以通过以下方式进行测试:
如果您随后执行 fab -V ,它应该显示它是 1.0.2a - 如果是这样,运行您的 fabfile 可能会工作得更好。如果您这样做,请告诉我们!
As Chris R mentions, we don't do a ton of Windows support as none of the core devs are Windows users; we have to rely on reports and suggestions from our more savvy Windows users.
It sounds like this could be related to this recently fixed, but not released, bug -- it will be in Fabric 1.0.2 which should be out soon. If you're feeling brave, you can test it out now via:
If you then do
fab -V
, it should say it's 1.0.2a -- if so, running your fabfile may work better. Please let us know if you do this!