您的位置:首页 > 编程语言 > Python开发

TypeError: takes exactly 1 argument (2 given)

2018-03-23 19:46 2296 查看
执行以下脚本报错:

TypeError: takes exactly 1 argument (2 given)

#!/usr/bin/env python
# -*- coding: utf-8 -*-

'''
Created on 2017-12-18
@author: sxli

'''
import redis
import sys
class  PublishChannel(object):
#kword = u"桌面".encode('gb2312')
def send_pybot(self,msg):
message=["msg1","msg2","msg3"]
'''
msg1:对参与者端共享app进行外窗口操作
msg2:对参与者端共享app进行内窗口操作
msg3:参与者端托盘断开连接重连操作

'''
pool=redis.ConnectionPool(host='192.168.3.58',port=6379,db=0)
r = redis.StrictRedis(connection_pool=pool)
# input = raw_input("publish:")
if msg in message:
r.publish('spub', msg)
if  input == 'over':
print '停止发布'
# break;
if __name__ == "__main__":
Do = PublishChannel()
Do.send_pybot(sys.argv[1])
print "finish msg to Channel !"


主要是因为没有弄清python 类 中初始化需要加self

def send_pybot(self,msg):
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  python