[question]python script - problem come from x-nemo.APP.conf (need help).

asked 2017-10-15 21:47:52 +0300

Schturman gravatar image

Hi to all
I have a little problem with my python script for custom notification and problem come from .conf file. To be more exactly from one specific line in this .conf file. This problem started from v2.1.1.23.
Here is my python script:

#!/usr/bin/python
import dbus

bus = dbus.SessionBus()
object = bus.get_object('org.freedesktop.Notifications','/org/freedesktop/Notifications')
interface = dbus.Interface(object,'org.freedesktop.Notifications')
#print(interface.GetCapabilities())

interface.Notify("Battery notifier",
                 0,
                 "icon-m-batterynotifier",
                 "Your battery is 5% !",
                 "Discharging...",
                 dbus.Array(["default", ""]),
                 dbus.Dictionary({"x-nemo-preview-body": "Discharging...",
                                  "x-nemo-preview-summary": "Your battery is 5% !",
                                  "category": "x-nemo.batterynotifier"},
                                  signature='sv'),
                 0)

In the "category" I use my x-nemo.batterynotifier.conf file with this content:

urgency=2
x-nemo-icon=icon-m-batterynotifier
x-nemo-preview-icon=icon-m-batterynotifier
x-nemo-feedback=battery_notifier
x-nemo-priority=125
x-nemo-user-removable=false
x-nemo-display-on=true

Until v2.1.1.23 all worked perfectly, but now (also on 2.1.2.3) I noticed that I don't get notifications at all. I checked it manually via terminal and got this output:

[nemo@Jolla-C ~]$ python /usr/share/openrepos-batterynotifier/notifier3.py
Traceback (most recent call last):
  File "/usr/share/openrepos-batterynotifier/notifier3.py", line 19, in <module>
    0)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: PID 25730 is not in privileged group
[nemo@Jolla-C ~]$

Started to check all my files and found that if I removing line "x-nemo-user-removable=false" from my .conf file, all work perfectly, but it user removable and I don't want it, I want to prevent from user removing this notification from event screen (it's doing another my script automatically).
Someone know how to fix it ?
Thanks.

edit retag flag offensive close delete

Comments

I think there have been some changes in what DBUS APIs unpriviledged code can access, but I don't know the specifics (I just spotted that in one of the recent changelogs).

MartinK ( 2017-10-16 01:40:15 +0300 )edit

Some system .conf files like "x-nemo.system-update.conf" also have this line "x-nemo-user-removable=false" and it work (user can't remove system-update notification from event screen)... That mean (I think so) I need do some changes in my script, but I don't know what exactly...

Schturman ( 2017-10-16 03:15:59 +0300 )edit