I am using the event example from the README, using the SkypeEventLoop.
When a new user that is not in my contact list writes me, the program crashes. The trackback is at the bottom of this report.
When I start the script again, it works as expected.
Account type
Live Account, created several days ago
Conversation details
1:1 chat with a new (not approved) contact
Steps to reproduce
Run the following script, and write to Skype account from a new, previously unapproved contact.
In order to test it, so you don't need to create an account, you can delete the contact (Right click on the Contact > Profile > Delete Contact ), and afterwards delete the conversation, and restart the script.
from skpy import SkypeEventLoop, SkypeNewMessageEvent
username = 'your@email'
password = 'your password'
class SkypePing(SkypeEventLoop):
def onEvent(self, event):
# return if it is not an MessageEvent
if not isinstance(event, SkypeNewMessageEvent):
return
# return if it is my own message
if event.msg.userId == self.userId:
return
print(event.msg.chat)
if "ping" in event.msg.content.lower():
event.msg.chat.sendMsg("Pong!")
if __name__ == "__main__":
sk = SkypePing(username, password, autoAck=True)
sk.loop()
Result or traceback
{{---skype-id---}} is the Skype ID of the sender account, removed from the traceback for privacy issues
The program crashes with the following error
Traceback (most recent call last):
File "/home/martin/work/venv/skype_test/lib/python3.10/site-packages/skpy/chat.py", line 457, in __getitem__
return super(SkypeChats, self).__getitem__(key)
File "/home/martin/work/venv/skype_test/lib/python3.10/site-packages/skpy/core.py", line 138, in __getitem__
return self.cache[key]
KeyError: '8:${{---skype-id---}}'