Listing HAL devices

mukesh tiwari mukeshtiwari.iiitm at gmail.com
Thu Sep 1 18:04:29 CEST 2011


On Sep 1, 8:46 pm, mukesh tiwari <mukeshtiwari.ii... at gmail.com> wrote:
> Hello all
> I am trying to write a python script which detects usb pen drive and
> copy all the data into my home directory. After bit of searching , i
> found these two links 1]http://en.wikibooks.org/wiki/Python_Programming/Dbus
> and 2]http://stackoverflow.com/questions/469243/how-can-i-listen-for-usb-de...
> . I just copied the wiki program but after running it , i got error
>
> import dbus
>
> class BusListener:
>         def __init__( self ):
>                 self.bus = dbus.SystemBus()
>                 self.hal_obj =
> self.bus.get_object('org.freedesktop.Hal' , '/org/freedesktop/Hal/
> Manager' )
>                 print self.proxy
>
> if __name__ == "__main__":
>         obj = BusListener()
>
> Traceback (most recent call last):
>   File "Mount.py", line 13, in <module>
>     obj = BusListener()
>   File "Mount.py", line 7, in __init__
>     self.hal_obj = self.bus.get_object('org.freedesktop.Hal' , '/org/
> freedesktop/Hal/Manager' )
>   File "/usr/lib/pymodules/python2.7/dbus/bus.py", line 244, in
> get_object
>     follow_name_owner_changes=follow_name_owner_changes)
>   File "/usr/lib/pymodules/python2.7/dbus/proxies.py", line 241, in
> __init__
>     self._named_service = conn.activate_name_owner(bus_name)
>   File "/usr/lib/pymodules/python2.7/dbus/bus.py", line 183, in
> activate_name_owner
>     self.start_service_by_name(bus_name)
>   File "/usr/lib/pymodules/python2.7/dbus/bus.py", line 281, in
> start_service_by_name
>     'su', (bus_name, flags)))
>   File "/usr/lib/pymodules/python2.7/dbus/connection.py", line 630, in
> call_blocking
>     message, timeout)
> dbus.exceptions.DBusException:
> org.freedesktop.DBus.Error.ServiceUnknown: The name
> org.freedesktop.Hal was not provided by any .service files
>
> Kindly some one please tell me why i am getting this error .
> Thank you

I am using Ubuntu 11.04 .



More information about the Python-list mailing list