pythonでMountain Lionのnotificationを叩いてみた
最近Mountain Lionにしたので、pythonからnotification叩いてみた。
といってもスクリプトが公開されているので、それをつかっただけ。
https://github.com/maranas/pyNotificationCenter
# coding=utf-8 import pyNotificationCenter pyNotificationCenter.notify("Hello, World!", "this is test message", u"音がなるよ", sound=True)
pythonはMacにバンドルされている/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonを使わないと動かなかった。
brew で入れたpython2.7.5にpyobjcをインストールしても以下のエラーになってしまう。
AttributeError: 'NoneType' object has no attribute 'scheduleNotification_'
バンドルされているpythonからvirtualenv作っても同じエラーになった
mkvirtualenv --python=/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python --system-site-packages systemenv