472,952 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

simple dbus python problem ... please help

bob
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 :)
Jul 29 '06 #1
1 2246

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.

Jul 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: pber | last post by:
Hi all, I'm on trouble with pymacs and python binding of DBus 0.23. Emacs/Xemacs have their gnuclient(s) to make remote calls to, but I wanted to (try to) make some xemacs functions callable...
0
by: Neil Woolford | last post by:
I'd like to be able to pop up a notification bubble like the ones used by Ubuntu for 'updates available' etc. In particular I'd like to be able to use them to warn users of other machines that I...
1
by: bob | last post by:
Hello, First of all, does anyone know whether dbus will allow be to do 3 things: 1. query whether or not there is a dvd drive. 2. query whether or not there is a blank disc in it. 3. query...
2
ashitpro
by: ashitpro | last post by:
I am using dbus-1.0.2 I am getting few run time errors. To debug this thing I want to build the dbus with rdynamic. How can I do that?
0
by: Yann Leboulanger | last post by:
Are there any python dbus bindings under windows ?
4
by: est | last post by:
Hi all I am trying to port Scribes to Windows, but I could not find a package named dbus-python for windows. There is a windbus <http:// sourceforge.net/projects/windbus/but it not for Python,...
0
by: huisan.wang | last post by:
Hello everyone, I am writing a program with twisted and dbus and got a such problem. If i run the code as $python local_proxy.py There is an error like this: Traceback (most recent call...
0
by: Frank Aune | last post by:
Hi, Im using DBUS in my application to detect HW hotplugging and removal, which works great except for one thing: The code executed when a hotplugging is detected does not raise exceptions, even...
0
by: Oguz Yarimtepe | last post by:
Hi all, I need an example to adjust the backlight brightness via python-dbus. I will test it from console so no need for a gui. Will be happy at least for the name of the methods or some...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.