I am trying to put notification to notification centre (Mac OSX) I am using PyObjC bindings to use cocoa api's from our python application.
I am using following code snippet :
import Foundation¬
import objc¬
NSUserNotification = objc.lookUpClass('NSUserNotification')¬
NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter')¬
notification = NSUserNotification.alloc().init()¬
notification.setTitle_("TestTitle")¬
notification.setInformativeText_("This is sample text")¬
center = NSUserNotificationCenter.defaultUserNotificationCenter()¬
center.deliverNotification_(notification)¬
When I run above directly from python it runs fine and shows notification in notification centre. However when I package above program using PyInstaller to prepare binary and run it gives following error.
AttributeError: 'NoneType' object has no attribute 'deliverNotification_'
This means I am not getting object of default user notification centre.
Has somebody come across this problem?
Thanks in advance.