OSX: DBus Session Lookup Always Fails when Run from Cron or a Parent Process - Direct Exec Always Works
Jim Mannix
j_mannix at apple.com
Thu Dec 17 18:07:57 PST 2015
Hi Folks,
Got to a point where I am really looking for help now as I am running out of ideas and hitting the limits of my skills/experience on this one. This is the context of my issue:
I’ve tried a great many things to get a Qt/DBus application to work under automation, but it only works when run directly.manually by a human in a terminal .. and the application is intended for cron automation or automation by a parent process.
So I’ve hit a dead end now in being able to automate, an otherwise working script/application and thus the whole project is blocked on this issue .. as things can sometimes happen. :)
The application itself is a Qt GUI application which comes with a Perl library for automation and DBus is used in between the Perl and the Qt QUI application (which runs with no window when being automated in this manner.) It processes log files and needs automation because it has so many input variations and usage modes and is needed sometimes to process a lot of logs in an automated context.
The issue itself:
On Mac OSX, both on Yosemite and El Capitan, the perl-dbus script, using the App’s perl library, works perfectly when run manually, by a human, in the terminal.
The same perl-dbus script, when run from a crontab entry OR when run from a parent python script (launching it using the subprocess module) will always fail with this error:
"Dynamic session lookup supported but failed: launchd did not provide a socket path, verify that org.freedesktop.dbus-session.plist is loaded!
org.freedesktop.DBus.Error.NoMemory: Not enough memory"
(Process exit status is 255.)
The ONLY way the perl-dbus script runs (and runs perfectly) is manually.
ALL of the following combinations fail the same way:
perl-dbus script run from cron
parent python script running perl-dbus script, python parent script run from cron
parent python script running perl-dbus script, python parent script run manually
ALSO,
I tried getting an interactive shell using python+pexpect+ssh, had a python parent script ssh to localhost (hence the idea being I would now have an interactive shell) and then simulate typing the perl-dbus command, then wait for pattern match of a returned prompt etc) I actually thought this would solve the environment-variable/interactive-prompt issue .. but it did not work either.
I realize the problem may lie in how DBus is trying to identify it’s session, either by which PID it is trying to identify, which user or via some environment variable. Idea being .. what is different about all the contexts in which it does not work?
Any help will be greatly appreciated by quite a number of folks actually.
Regards,
Jim
zerosyntax at yahoo.com <mailto:zerosyntax at yahoo.com>
Contractor/Python-Programmer/Automation-System Architect .. currently working on a project automating testing at Apple.
##
#
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20151217/4b3f2e80/attachment.html>
More information about the dbus
mailing list