小编Min*_*ngo的帖子

如何在Fabric收到错误时继续执行任务

当我定义要在多个远程服务器上运行的任务时,如果任务在服务器1上运行并退出并出现错误,则Fabric将停止并中止该任务.但是我想让Fabric忽略错误并在下一个服务器上运行任务.我该怎么做呢?

例如:

$ fab site1_service_gw
[site1rpt1] Executing task 'site1_service_gw'

[site1fep1] run: echo 'Nm123!@#' | sudo -S route
[site1fep1] err:
[site1fep1] err: We trust you have received the usual lecture from the local System
[site1fep1] err: Administrator. It usually boils down to these three things:
[site1fep1] err:
[site1fep1] err:     #1) Respect the privacy of others.
[site1fep1] err:     #2) Think before you type.
[site1fep1] err:     #3) With great power comes great responsibility.
[site1fep1] err: root's password:
[site1fep1] err: sudo: route: command not …
Run Code Online (Sandbox Code Playgroud)

python fabric

93
推荐指数
6
解决办法
5万
查看次数

python子进程communication()块

我正在使用进程模块调用外部程序(plink.exe)来登录服务器; 但是当我呼叫通信来读取输出时,它就是阻塞.代码如下:

 import subprocess
 process = subprocess.Popen('plink.exe hello@10.120.139.170 -pw 123456'.split(), shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 print process.communicate() #block here
Run Code Online (Sandbox Code Playgroud)

我知道该块是因为plink.exe它仍在运行; 但我需要在子进程终止之前读取输出.反正有吗?

python subprocess blocking

15
推荐指数
1
解决办法
2万
查看次数

如何绑定密钥以在dired emacs中运行shell命令

当我在emacs中使用dired模式时,我可以按类型!xxx运行shell命令,但是如何绑定一个键来运行这个命令?例如,我想在文件上按O,然后dired将运行'cygstart'来打开这个文件.

emacs dired

8
推荐指数
1
解决办法
2002
查看次数

如果选择了区域,如何将Ck绑定到kill-region; 别杀了

在emacs中,如果选择了区域,我想将Ck绑定到kill-region; 其他杀线正常.如何配置?

emacs

7
推荐指数
2
解决办法
420
查看次数

如何使用feedparser解析“ <media:group>”?

rss文件如下所示,我想在media:group部分中获取内容。我检查了feedparser的文档,但似乎没有提及。怎么做?任何帮助表示赞赏。

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:ymusic="http://music.yahoo.com/rss/1.0/ymusic/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel>
        <title>XYZ InfoX:  Special hello  </title>
        <link>http://www1.XYZInfoX.com/learninghello/home</link>
        <description>hello</description>
        <language>en</language>         <copyright />
        <pubDate>Wed, 17 Mar 2010 08:50:06 GMT</pubDate>
        <dc:creator />
        <dc:date>2010-03-17T08:50:06Z</dc:date>
        <dc:language>en</dc:language> <dc:rights />
        <image>
            <title>Voice of America</title>
            <link>http://www1.XYZInfoX.com/learninghello</link>
            <url>http://media.XYZInfoX.com/designimages/XYZRSSIcon.gif</url>
        </image>

        <item>
                <title>Who Were the Deadliest Gunmen of the Wild West?</title>
                <link>http://www1.XYZInfoX.com/learninghello/home/Deadliest-Gunmen-of-the-Wild-West-87826807.html</link>
                <description> The story of two of them: "Killin'" Jim Miller was an outlaw, "Texas" John Slaughter was a lawman | EXPLORATIONS  </description>
                <pubDate>Wed, 17 Mar 2010 00:38:48 …
Run Code Online (Sandbox Code Playgroud)

python rss feedparser

4
推荐指数
1
解决办法
2512
查看次数

标签 统计

python ×3

emacs ×2

blocking ×1

dired ×1

fabric ×1

feedparser ×1

rss ×1

subprocess ×1