473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 2265

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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.