Macports で入れた Python で Skype4Py を使う

Mac OS X 10.6.3 で Skype4Py を使いたいんだけど、Segmentation fault が発生する。

と思ったら、ドンピシャな方が。

Skype4Pyがsegmentation fault する - mfumiの日記


なるほど、python を 32bit アプリケーションとして起動してやればいいのか。


ただ自分は Mac デフォルトの Python は使わずに、Macports で複数バージョンの Python を入れて、virtualenv で必要な環境をその都度作ったり、切り替えてる。

$ port installed | grep python
python24 @2.4.6_4+darwin+darwin_10+macosx (active)
python25 @2.5.4_9+darwin+darwin_10+macosx (active)
python26 @2.6.4_0+darwin+universal (active)
python31 @3.1.1_0+darwin (active)
python_select @0.3_0+darwin_10 (active)


今回は python26+universal を 32bit アプリケーションとして動かしたいので、

$ cp python python.bak
$ lipo python -thin i386 -output python


とすればOK。Skype4Py も動いたよ。

#!/usr/bin/env python
# -*- coding:utf-8 -*-
import Skype4Py

def main():
    skype = Skype4Py.Skype()
    skype.Attach()
    print skype.CurrentUser.FullName

if __name__ == '__main__':
    main()