Dan*_*nka 1 python segmentation-fault
我有一个相当简单的Python脚本:
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()
Run Code Online (Sandbox Code Playgroud)
当我运行它时,我有时会得到这个:
~$ python RandomStatus.py
Segmentation fault
~$
Run Code Online (Sandbox Code Playgroud)
但是,其他时候,脚本运行得很好.我所有其他Python脚本也可以正常工作.这个错误并没有真正给我足够的背景甚至知道在哪里看.有任何想法吗?即使只是一种方法来获得一些实际的调试信息将不胜感激.
nio*_*ioq 10
Skype4Py遇到了类似的问题,至少在我的情况下,事实证明Skype4Py在Mac上不适用于64位Python.可能不适用于你,因为你的脚本有时会工作.
如果您使用的是Mac,请参阅Ned Deily在此问题中关于如何运行32位Python的评论:如何在Snow Leopard和其他32位/ 64位问题上强制使用Python 32位
在写完上述内容后的几个小时,我在Linux上遇到了类似的间歇性seg故障.在这种情况下,当我使用X11而不是DBUS连接时,seg故障消失了
Skype4Py.Skype(Transport='x11')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2678 次 |
| 最近记录: |