1

I downloaded the "pynotify" package using pip. After running the code the error is "module 'pynotify' has no attribute 'init'" Thank You for the help.

Manu
  • 19
  • 2
  • Here is the basic code : import pynotify pynotify.init("Basic") n = pynotify.Notification("Title", "Some sample content" ) n.show() – Manu Feb 05 '17 at 13:52
  • Did you ever figure this out, I'm running into the same issue – ghosting999 Apr 27 '17 at 20:32
  • [`pynotify`](https://pypi.python.org/pypi/pynotify) source on [Github](https://github.com/GiulioRossetti/pynotify/blob/master/pynotify/__init__.py) clearly shows that this module _does not have_ `init` member – Łukasz Rogalski Jun 23 '17 at 06:40

2 Answers2

1

I don't know but it looks like to be a library conflict.

I already had the same problem and I was not able to solve it. I suggest you to try using subprocess that worked for me, see below:

import subprocess
subprocess.Popen(['notify-send', "Message"])

Note: notify-send command is only Linux distributions.

You can get more notify-send informations here.

Manoel Stilpen
  • 1,219
  • 1
  • 10
  • 11
0

Because there are multiple projects called "pynotify", there's ambiguity. The one that gets installed when doing pip install pynotify is probably not the one you were hoping for.

ubuntu:~/> pip show pynotify
-->cut<--
Name: pynotify
Version: 0.1.1
Summary: Python decorator that notify via email (Gmail) the termination (and eventual stacktrace in case of failure) of a function
-->cut<--

Here's another one that seems to do what you want : And I quickly tested it, it seems to work (shows a notification toaster popup in the screen corner) https://ms7m.github.io/notify-py/

ubuntu:~/> pip install notify-py

ubuntu:~/> python3
>>> from notifypy import Notify
>>> notification = Notify()
>>> notification.title = "Cool Title"
>>> notification.message = "Even cooler message."
>>> notification.send()
True
>>> 
multia
  • 21
  • 6