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

[tip] Problem with linux notifications - solved #105

Open
MattPorto opened this issue Sep 4, 2016 · 8 comments
Open

[tip] Problem with linux notifications - solved #105

MattPorto opened this issue Sep 4, 2016 · 8 comments

Comments

@MattPorto
Copy link

Hi guys,
Trying to run a $ntfy send test command after installing ntfy using sudo pip install ntfy and i get the following exception:

ERROR: Failed to send notification using default
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/ntfy/__init__.py", line 48, in notify
    **backend_config)
  File "/usr/local/lib/python2.7/site-packages/ntfy/backends/default.py", line 22, in notify
    raise DefaultNotifierError(e, module)

DefaultNotifierError

I searched something like this in the closed issues and i found the issue #95, where the SteveEdson had the same problem and he said that he ran the command $ cat ~/.config/ntfy/ntfy.yml to check if the config file is ok, and there i noticed that this path doesn't exist on my .config folder. So I created the ntfy folder using mkdir ntfy and then i used a text editor to create the ntfy.yml and put the following code inside it:

--- 
backends: 
    - linux

so, when i ran $ ntfy send test again, it resulted in the follow message:

ImportError: No module named dbus

So i realized that i don't had the dbus package installed on my machine, then i ran sudo apt-get install python-dbus to install this and when i ran again $ntfy send test it works pretty nice!

Maybe it is too obvious or a newbie question, but i decide to post it here because it stucked me when i try to run the script for the first time, and i wasted some time to discover how to fix that. I hope that issue can help someone that have the same trouble when try to install the app, so i think that can be usefull.

se ya! :)

@DanielAndreasen
Copy link

Thanks, I managed the first part :)
But with pip (installed with Anaconda), I didn't manage to install the dbus dependency and gave up...
If someone manage to do this, please let me know.

@dschep
Copy link
Owner

dschep commented Sep 6, 2016

I'll look into adding python-dbus to the deps on linux. It was just always present (in the system site-packages) on distros I used.

@Hirmuli
Copy link

Hirmuli commented Nov 11, 2016

After downloading the python-dbus it fixed the "ntfy test" problems on my end. Thank you @MattPorto for this tip. Really appreciate it and I recommend adding this to the Quick Start guide for newbies like me.

EDIT. The problem I'm having is that after running the other tests it seems that I'm getting new errors and ntfy send test has stopped working

@dschep
Copy link
Owner

dschep commented Nov 11, 2016

What're your new errors @Hirmuli?

@Hirmuli
Copy link

Hirmuli commented Nov 14, 2016

@dschep

ntfy send test
_ERROR: Failed to send notification using default Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ntfy/init.py", line 65 in notify
**backend_config)
File "/usr/local/lib/python2.7/dist-packages/ntfy/backends/dafault.py", line 22, in notify
raise DefaultNotifierError(e,module)
DefaultNotifierError

ntfy test worked until I started to try out the "Quick start guide"

Even the test stopped working after I ran ntfy -e "backends", also pushover didnt work or the other notifications. Only ntfy test and ntfy custom title worked.

@mccarthyryanc
Copy link

I had a similar problem in Ubuntu 16.04. What solved the issue for me was installing the following dbus dev packages:

sudo apt install libdbus-1-dev libdbus-glib-1-dev

and then installing the python dbus module:

sudo pip install dbus-python

@DinosL
Copy link

DinosL commented Jun 23, 2017

I get the same error as @Hirmuli when i am trying to call p = Popen("ntfy -b pushbullet -o access_token token send 'test'", shell=True) from a python program. I tried what @mccarthyryanc suggested but no luck. Do you have any other suggestions?

@dschep
Copy link
Owner

dschep commented Jun 26, 2017

@DinosL did you follow @mccarthyryanc's directions regarding dbus-python and install globally or if in a virtualenv, ensure that --system-site-packages was set when creating it?

Once that works, you also have the option in python since ntfy is written in python of just doing:

from ntfy import notify
notify("Message body", "mesage title") # note a title is required, where as the CLI will set a default title

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

No branches or pull requests

6 participants