简体   繁体   English

结构:意外令牌'('附近的语法错误

[英]Fabric: syntax error near unexpected token '('

I have such fabfile.py: 我有这样的fabfile.py:

from fabric.api import *

def deploy():
    with prefix('source venv/bin/activate'):
        local('pex -r <(cat requirements.txt) . -o app.pex')

when I run $ fab deploy I get: 当我运行$ fab deploy我得到:

$ fab deploy
[localhost] local: pex -r <(cat requirements.txt) . -o app.pex
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex'

Fatal error: local() encountered an error (return code 1) while executing 'pex -r <(cat requirements.txt) . -o app.pex'

Aborting.

The command source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex 命令source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex runs OK in shell. source venv/bin/activate && pex -r <(cat requirements.txt) . -o app.pex在shell中运行正常。 I'm new to Fabric. 我是Fabric的新手。 What's wrong here? 怎么了

The fabric.operations.local() function by default uses /bin/sh as the shell to run the command. 默认情况下, fabric.operations.local()函数使用/bin/sh作为外壳程序来运行命令。 This basic shell doesn't support all of the syntax that /bin/bash would. 这个基本的shell不支持/bin/bash所支持的所有语法。

Set shell='/bin/bash' if you must have access to Bash shell syntax: 如果必须访问Bash shell语法,则设置shell='/bin/bash'

local('pex -r <(cat requirements.txt) . -o app.pex', shell='/bin/bash'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM