Search code examples
linuxpython-2.7skype4py

Segmentation fault in skype.Attach() in Python and Skype4Py


I tried to run a simple python code for Skype4Py here's my code

import Skype4Py
import logging

logging.basicConfig(level=logging.DEBUG)
print 'OK'
# Create Skype instance
print 'CREATE'
skype = Skype4Py.Skype()
print 'CREATED'

# Connect Skype object to Skype client
print 'CONNECT'
skype.Attach()
print 'CONNECTED'

print 'Your full name:', skype.CurrentUser.FullName
print 'Your contacts:'
for user in skype.Friends:
  print 'LOOP'
  print '    ', user.FullName
  print 'DONE'

and my output is this

OK
CREATE
INFO:Skype4Py.skype.Skype:object created
INFO:Skype4Py.api.posix_dbus.SkypeAPI:opened
CREATED
CONNECT
INFO:Skype4Py.api.posix_dbus.SkypeAPI:thread started
Segmentation fault
Segmentation in skype.Attach().

Anyone knows how to solve this? Thanks


Solution

  • Use X11 transport to avoid segmentation faults

    https://github.com/opensourcehacker/sevabot/blob/master/sevabot/bot.py#L30

    Also use patched version of Skype4Py and do not try to use anything provided by your Linux distribution

    https://github.com/stigkj/Skype4Py

    More information about the segfaults with Skype4Py

    https://github.com/opensourcehacker/sevabot#segfaults