开发者

How does one get the output of fabric execution (fab.exe) on windows 7?

开发者 https://www.devze.com 2023-02-06 20:56 出处:网络
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 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 wi开发者_运维问答ndow 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.


DiggyF's suggestion worked great for taming the cmd shell

fab hello > output.txt 2>&1

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:

from fabric.contrib.console import confirm
def hello():
    ...
    confirm("Would you like to exit?")
0

精彩评论

暂无评论...
验证码 换一张
取 消