Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows notification - NotImplementedError: No usable implementation found! #485

Closed
aquaristar opened this issue Dec 7, 2018 · 4 comments

Comments

@aquaristar
Copy link

aquaristar commented Dec 7, 2018

Python == 3.7.1
Windows 10
Plyer == 1.3.2
PyInstaller == 3.4

After I packed exe file with PyInstaller I got following error when I run notify.

Traceback (most recent call last):
File "main.py", line 57, in
File "venv\lib\site-packages\kivy\app.py", line 826, in run
File "venv\lib\site-packages\kivy\base.py", line 502, in runTouchApp
File "venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 727, in mainloop
File "venv\lib\site-packages\kivy\core\window\window_sdl2.py", line 460, in _mainloop
File "venv\lib\site-packages\kivy\base.py", line 340, in idle
File "venv\lib\site-packages\kivy\base.py", line 325, in dispatch_input
File "venv\lib\site-packages\kivy\base.py", line 231, in post_dispatch_input
File "kivy_event.pyx", line 707, in kivy.event.EventDispatcher.dispatch
File "venv\lib\site-packages\kivy\core\window_init
.py", line 1360, in on_motion
File "kivy_event.pyx", line 707, in kivy.event.EventDispatcher.dispatch
File "venv\lib\site-packages\kivy\core\window_init
.py", line 1376, in on_touch_down
File "kivy_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "venv\lib\site-packages\kivy\uix\widget.py", line 460, in on_touch_down
File "kivy_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "venv\lib\site-packages\kivy\uix\behaviors\button.py", line 151, in on_touch_down
File "kivy_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch
File "kivy_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
File "kivy_event.pyx", line 1098, in kivy._event.EventObservers._dispatch
File "venv\lib\site-packages\kivy\lang\builder.py", line 64, in custom_callback
File "D:\PycharmProjects\AbcAlarm\dist\abcalarm\notificationdemo.kv", line 22, in
on_press: root.do_notify(mode='normal')
File "main.py", line 45, in do_notify
File "venv\lib\site-packages\plyer\facades\notification.py", line 57, in notify
File "venv\lib\site-packages\plyer\facades\notification.py", line 62, in _notify
NotImplementedError: No usable implementation found!
[12896] Failed to execute script main

class NotificationDemo(BoxLayout):

def do_notify(self, mode='normal'):
    title = self.ids.notification_title.text
    message = self.ids.notification_text.text
    ticker = self.ids.ticker_text.text
    if PY2:
        title = title.decode('utf8')
        message = message.decode('utf8')
    kwargs = {'title': title, 'message': message, 'ticker': ticker}

    if mode == 'fancy':
        kwargs['app_name'] = "Plyer Notification Example"
        if platform == "win":
            kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                      'plyer-icon.ico')
            kwargs['timeout'] = 4
        else:
            kwargs['app_icon'] = join(dirname(realpath(__file__)),
                                      'plyer-icon.png')
    notification.notify(**kwargs)
@KeyWeeUsr
Copy link
Contributor

Try to print(plyer.utils.platform), because I think the problem is with a platform value being unknown for some weird reason. Otherwise you'd actually get some real error. This issue is just a Proxy not being able to get plyer.platforms.win.notification.instance() value and therefore it just returns the default Proxy value i.e. plyer.facades.notification.Notification.

Quick workaround for that is to use the platform specific module directly (plyer.platforms.win.notification.instance()).

@KeyWeeUsr KeyWeeUsr changed the title NotImplementedError: No usable implementation found! Windows notification - NotImplementedError: No usable implementation found! Dec 24, 2018
@brsaylor
Copy link

I was having a similar issue with the FileChooser on macos, and I solved it by adding the platform-specific module to hiddenimports in the spec file. For this issue, the change would be something like:

a = Analysis(
   ...
   hiddenimports=['plyer.platforms.win.notification'],
   ...

@samuelkazeem
Copy link

@brsaylor hiddenimports did the trick

@aquaristar
Copy link
Author

@brsaylor , Thanks for your help.
I didn't import plyer notification explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants