Skype4Py不会在Windows上附加到Skype

时间:2014-12-18 16:39:20

标签: python skype skype4py

我正在使用32位python在我的win 8机器上运行它,当我运行程序时skype正在响应一条消息(见顶部栏):"另一个应用程序(python.exe)是尝试访问Skype,但我们无法回复。请尝试重新启动应用程序"

代码:

import Skype4Py
import socket
import codecs
import sys
#setup
#sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#server_address = ('127.0.0.1', 65205)
#print  'starting up on '+ str(server_address[1])
#sock.bind(server_address)
#sock.listen(1)
#enableling different languages 
UTF8Writer = codecs.getwriter('utf8')
sys.stdout = UTF8Writer(sys.stdout)
#skype setup
skype =Skype4Py.Skype()
availFriends = []
skype.Attach()

#block mode
def mstat(Message,status):
    if(status == Skype4Py.cmsReceived ):#act on receive
        Message.MarkAsSeen()
        print Message.Body
        skype.SendMessage(Message.Sender.Handle,"Did you send me :\n"+Message.Body+"\n good , Stop messaging me!")

def GetAllOnlinePeople():
    availFriends = []
    badStatusCodes = ['UNKNOWN', 'OFFLINE', 'DND', 'LOGGEDOUT']
    for f in skype.Friends:
        if not f.OnlineStatus in badStatusCodes:
            availFriends.append(f)


###########################################3
#connection, client_address = sock.accept()
#print  'connection from'+ str(client_address[0])
# Receive the data in small chunks and retransmit it    
#data = connection.recv(128)
#if data== 'bmode':
skype.OnMessageStatus = mstat
while(1==1):
    i='p'

1 个答案:

答案 0 :(得分:1)

不确定这会有所帮助,但最近我在尝试从Windows PowerShell启动sevabot时看到了类似的Skype消息。 请参阅下面的截图: enter image description here

一旦我从Windows cmd启动它,该警报就消失了。 我的Skype版本是7.16.85.102,Skype4Py版本是1.0.35。

希望有所帮助。