Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > simple dbus python problem ... please help

Reply
Thread Tools

simple dbus python problem ... please help

 
 
bob
Guest
Posts: n/a
 
      07-29-2006
Hi,

I have this sample python script from the hal sources, but it doesn't work
for me. This is despite other example python scripts I have to help me are
working fine. The problem is that this script is the closet to what it is
I actually want to learn to do.

The error is:

Traceback (most recent call last):
File "./dbus-3.py", line 6, in ?
hal_service = bus.get_service ('org.freedesktop.Hal')
AttributeError: 'SystemBus' object has no attribute 'get_service'


The script is as follows:

#!/usr/bin/python

import dbus

bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
hal_service = bus.get_service ('org.freedesktop.Hal')
hal_manager = hal_service.get_object ('/org/freedesktop/Hal/Manager',
'org.freedesktop.Hal.Manager')

volume_udi_list = hal_manager.FindDeviceByCapability ('volume')
for udi in volume_udi_list:
volume = hal_service.get_object (udi, 'org.freedesktop.Hal.Device')
device_file = volume.GetProperty ('block.device')
fstype = volume.GetProperty ('volume.fstype')
storage_udi = volume.GetProperty ('block.storage_device')
storage = hal_service.get_object (storage_udi, 'org.freedesktop.Hal.Device')
drive_type = storage.GetProperty ('storage.drive_type')
print 'udi=%s device_file=%s fstype=%s drive_type=%s'%(udi,
device_file, fstype, drive_type)

Documentation on this stuff is extremely thin on the ground, so links to
any good resources other than those at freedesktop.org would be most
appreciated!

All I really want to do is have a nice routine to do the following:

1. check whether or not a user has a dvd drive.
2. check whether a disc is in it.
3. if there is a disc in the drive, check the various properties relating
to it.

Surely it cannot be that hard to get enough information to work out how to
do that!

Thanks for reading
 
Reply With Quote
 
 
 
 
alisonken1
Guest
Posts: n/a
 
      07-29-2006

bob wrote:

<snip>

> bus = dbus.Bus (dbus.Bus.TYPE_SYSTEM)
> hal_service = bus.get_service ('org.freedesktop.Hal')
> hal_manager = hal_service.get_object ('/org/freedesktop/Hal/Manager',
> 'org.freedesktop.Hal.Manager')
>

<snip>

It appears that bus.get_service() has been deprecated and deleted.

Not sure about the changes, so anyone else who can help please jump in.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
python-dbus example request Oguz Yarimtepe Python 0 06-25-2008 07:12 PM
python, dbus and pointers help. Glich Python 2 03-25-2008 08:36 PM
dbus-python for windows est Python 4 01-17-2008 08:26 PM
python and dbus - beginner seeking some help bob Python 1 07-28-2006 06:12 PM
python and dbus - beginner seeking some help bob Python 0 07-28-2006 06:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57