如何在 Windows 7 上获取结构执行 (fab.exe) 的输出?
我对使用 Fabric 作为部署工具很感兴趣,但在完成本教程时遇到了困难。我相信我已经正确安装了它(我使用了 easy-install)
我已经在 fabfile.py 中定义了示例函数:
def hello():
print("Hello world!")
然后我打开一个命令窗口并运行
C:\dev>fab hello
第二个 cmd shell 窗口打开,然后几乎立即再次关闭,我不知道它说了什么。
我尝试使用 /K 选项打开命令窗口
c:\dev>cmd /K "fab hello"
,并且尝试将输出重定向到文件,但该文件返回为空。
c:\dev>fab hello >> output.txt
任何提示、建议或评论表示赞赏。
I am am interested in using Fabric as a deployment tool and I am having trouble making it through the tutorial. I believe I have it installed correctly (I used easy-install)
I have defined the sample function in fabfile.py:
def hello():
print("Hello world!")
I then open a command window and run
C:\dev>fab hello
A second cmd shell window opens and then closes again nearly instantaneously and I have no idea what it says.
I have tried opening the command window with the /K option
c:\dev>cmd /K "fab hello"
And I have tried redirecting the output to a file, but the file comes back empty.
c:\dev>fab hello >> output.txt
Any hints, suggestions or comments appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DiggyF 的建议对于驯服 cmd shell 非常有效,
我现在得到了通过管道传输到文件的瞬时 shell 执行的输出。
输出:ImportError:没有名为 win32api 的模块。这导致我进行了更长的追寻,需要放在另一个问题中。
在 Windows 7 上运行 Fabric 的解决方案:
easy_install Fabric
手动安装 pycrypto-2.0.1.win-amd64-py2.6.exe:
http://www.voidspace.org.uk/python/modules.shtml
从以下位置手动安装 pywin32-214.win-amd64-py2.6.exe:
http://sourceforge.net/projects/pywin32/files/
防止 shell 关闭运行后立即可以使用:
DiggyF's suggestion worked great for taming the cmd shell
I now get the output of the instantaneous shell execution piped to a file.
The output: ImportError: No module named win32api. This led me on a much longer goose chase that needs to be placed in another question.
The solution to getting fabric running on Windows 7:
easy_install fabric
manually install pycrypto-2.0.1.win-amd64-py2.6.exe from:
http://www.voidspace.org.uk/python/modules.shtml
manually install pywin32-214.win-amd64-py2.6.exe from:
http://sourceforge.net/projects/pywin32/files/
To keep the shell from closing right away after running, you can use: