LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-19-2009, 09:26 AM   #1
kannerke
LQ Newbie
 
Registered: Apr 2005
Posts: 9

Rep: Reputation: 0
dbus as IPC for web service problem


Hello all,

I'm trying to use dbus inside cgi-python scripts as IPC to communicate with external processes running on the web server.

The first error I encountered was:
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: dbus-launch failed to autolaunch D-Bus session: Autolaunch error: X11 initialization failed

I was able to solve this by putting the environment variables, returned by executing the dbus-launch command, see
http://stackoverflow.com/questions/257658?sort=votes


At this point, I encounter the following problem:
DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name path.to.my.service was not provided by any .service files

My target service was running and waiting for incoming dbus calls.

This problem was not totally unexpected because executing the 'dbus-launch' command probably initiates a new dbus.


Can someone help me with how to connect to the right dbus calling bus = dbus.SessionBus() or how to connect the new dbus with the exisitng dbus.


To be clear: I have a python script running in a terminal, registered a dbus service and a python cgi script, executed by apache2 willing to access this service.


kind regards,
Peter
 
Old 03-25-2009, 09:59 AM   #2
kannerke
LQ Newbie
 
Registered: Apr 2005
Posts: 9

Original Poster
Rep: Reputation: 0
Hello all,

I managed to get it working :-). I needed to changed two things:

- first, I had to change the bus I used: I used the SessionBus instead of the SystemBus. Using the SystemBus, services are available through the whole system.

- second, I needed to add a policy file in /etc/dbus-1/system.d/. I found an example on http://kkaempf.blogspot.com/2009/02/...with-ruby.html


After getting these two things right, I was able to setup my service and access it through my cgi script :-)



Peter
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora Core 9 update dbus.exception & dbus.proxies & DBus.Error.AccessDenied errors trien27 Fedora 1 12-08-2008 11:23 PM
LXer: Create Web services with Ruby on Rails and Action Web Service LXer Syndicated Linux News 0 11-05-2008 06:00 PM
Tools for developing C# web service and web sites in Linux woodbase Linux - Software 3 08-10-2006 01:28 PM
IPC problem greghua Programming 2 08-19-2005 07:43 PM
ipc problem raven Programming 3 02-04-2002 10:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration