Python 如何使用Fabric永久更改目录?

Python 如何使用Fabric永久更改目录?,python,python-2.7,terminal,fabric,Python,Python 2.7,Terminal,Fabric,这是我的密码。其想法是切换到目录“Aquantia”,我也有一个符号链接,将字符串回显到文本文件中,然后将Hello World程序的输出重定向到文本文件中。如果我在实际的Aquantia目录中运行fabfile.py,它会工作,但当我从家中启动时,它会失败 from fabric.api import local, settings, abort, run, cd def run(): with cd('~/Aquantia'): local("echo 'love'

这是我的密码。其想法是切换到目录“Aquantia”,我也有一个符号链接,将字符串回显到文本文件中,然后将Hello World程序的输出重定向到文本文件中。如果我在实际的Aquantia目录中运行fabfile.py,它会工作,但当我从家中启动时,它会失败

from fabric.api import local, settings, abort, run, cd

def run():
    with cd('~/Aquantia'):
        local("echo 'love' > test.txt ")
        local("less test.txt")
        local("./test>test.txt")
        local("less test.txt")
以下是错误消息:

DN0a152ee4:~ bmassoumi$ fab run
[localhost] local: echo 'love' > test.txt 
[localhost] local: less test.txt
[localhost] local: ./test>test.txt
/bin/sh: ./test: No such file or directory

Fatal error: local() encountered an error (return code 127) while executing './test>test.txt'

Aborting.
local() encountered an error (return code 127) while executing './test>test.txt'
从:

cd
仅影响远程路径–要修改本地路径,请使用
lcd

从:

cd
仅影响远程路径–要修改本地路径,请使用
lcd