Starpy连接随机关闭

2024-06-16 10:47:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个应用程序,它使用最新版本的starpy,在大多数使用它的机器上大部分时间运行良好,但在其中一些机器上会随机停止。你知道吗

发生的情况:工厂停止自己(停止工厂)并抛出一个错误。 给出的错误是:“sequence index必须是整数,而不是'str'”,这似乎与我的代码无关。 有时此错误前面会出现以下错误:

File "/usr/lib64/python2.6/logging/__init__.py", line 797, in emit
[AMIProtocol,client]     stream.write(fs % msg)
[AMIProtocol,client] IOError: [Errno 5] Input/output error

该代码在以下两个部分代码之一中随机抛出错误: 注意:我正在使用“@defer.inline回调“decorator和变量client包含连接。你知道吗

try:
    dndExtensions = []
    dnd = yield client.command ( 'database show DND' )
    for extension in dnd:
        if 'DND' in extension:
            dndExtensions.append ( extension.split ( '/DND/' )[1].split (' ')[0] )
except Exception, e:
    # error ...


try:
    lunchExtensions = []
    lunch = yield client.command ( 'database show Lunch' )
    for extension in lunch:
        if 'Lunch' in extension:
            lunchExtensions.append ( extension.split ( '/Lunch/' )[1].split (' ')[0] )
except Exception, e:
    # error ...

你知道会发生什么吗?你知道吗


Tags: 代码inclient机器工厂错误extensionerror