I've got a fairly simple Python script:
import Skype4Py
from random import randint
from time import strftime, sleep
from os import system
interval = 5
def pickStatus():
try:
handler = open("lines.txt", "r")
lines = handler.read().split("\n")
handler.close()
rand = randint(0, len(lines))
line = lines[rand]
print strftime("%Y-%m-%d %I:%M %p [" + str(rand) + "] ") + line
system('notify-send "New status" "' + line + '"')
skype.CurrentUserProfile.MoodText = line
sleep(interval * 60)
pickStatus()
except KeyboardInterrupt:
pass
if __name__ == '__main__':
skype = Skype4Py.Skype()
skype.Attach()
pickStatus()
When I run it, I sometimes get this:
~$ python RandomStatus.py
Segmentation fault
~$
Other times, though, the script runs just fine. All my other Python scripts also work fine. This error doesn't really give me enough context to even know where to look. Any ideas? Even just a way to get some actual debug info would be appreciated.