halevt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Halevt-dev] [RFC] dbus/python branch


From: Patrice Dumas
Subject: Re: [Halevt-dev] [RFC] dbus/python branch
Date: Sat, 14 Aug 2010 15:24:39 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

Hello,

On Sat, Jun 19, 2010 at 11:55:59AM +0200, Raphaël wrote:
> Hi,
> - it entierly relies on dbus and dbus introspection :
> A daemon (like udisks or upower) is registrered as a dbus service thus
> provides Objects, Properties, Signals and Methods but also a listing of what
> values it returns, what signal name we can attach to, ... that's
> introspection.
> (these are also documented in the XML service description file usually found
> in /usr/share/dbus-1/*)

It looks like a relevant idea.

> Any thoughts, advices, criticisims, improvements, alternatives,
> ... welcomed

The source files are missing a comment at the beginning stating 
what is the purpose of the file.

I tried to start 'python dbusevt.py', and I got a pretty cryptic
error message:

 ERROR:root:: no such file

I guess that's because it requires a config file, still it is 
rather cryptic.


Then I have tried

python dbusevt.py  -v debug -n -c examples/sample.conf.xml

and I get

DEBUG:root:loading config: examples/sample.conf.xml
ERROR:root:/xsl/idref2ref.xsl: xslt doesn't exist

I found out that I have to call like

python ./dbusevt.py  -v debug -n -c examples/sample.conf.xml

I then tried with the attached file to see what information dbusevt 
can list but I get tracebacks when inserting a device (it works
when removing a device, with a call to a command without udisk
properties):

python ./dbusevt.py  -v debug -c test.xml 
....
INFO:root:DeviceAdded happened: got /org/freedesktop/UDisks/devices/sda2
DEBUG:root:matching props in Config :
<Element Event at 88df8ec>
DEBUG:root:running processObject() with /org/freedesktop/UDisks/devices/sda2
DEBUG:config:xpath(/Config/address@hidden = "added"]//address@hidden = 
"DeviceAdded"]/Do)
ERROR:dbus.connection:Exception in handler for D-Bus signal:
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/dbus/connection.py", line 214, in 
maybe_handle_message
    self._handler(*args, **kwargs)
  File "<string>", line 2, in dbus_callback_DeviceAdded
  File "./dbusevt.py", line 114, in processEvent
    processObject(config, dbusobjects.get(ret), event)
  File "./dbusevt.py", line 129, in processObject
    event)
  File "./dbusevt.py", line 67, in doit
    torun = command_substitute(torun, dbusobject)
  File "./dbusevt.py", line 140, in command_substitute
    torun)
  File "/usr/lib/python2.6/re.py", line 151, in sub
    return _compile(pattern, 0).sub(repl, string, count)
  File "/usr/lib/python2.6/re.py", line 273, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/lib/python2.6/re.py", line 258, in _compile_repl
    p = sre_parse.parse_template(repl, pattern)
  File "/usr/lib/python2.6/sre_parse.py", line 700, in parse_template
    s = Tokenizer(source)
  File "/usr/lib/python2.6/sre_parse.py", line 187, in __init__
    self.__next()
  File "/usr/lib/python2.6/sre_parse.py", line 189, in __next
    if self.index >= len(self.string):
TypeError: object of type 'dbus.Boolean' has no len()



I also think that you should put the link to properties in the
README, or explain how to discover these.

http://hal.freedesktop.org/docs/udisks/Device.html#Device.properties

-- 
Pat

Attachment: test.xml
Description: application/xml


reply via email to

[Prev in Thread] Current Thread [Next in Thread]