python - glib main loop hangs after Popen -
i'm trying build script logs window title when different window becomes active. have far:
import glib import dbus dbus.mainloop.glib import dbusgmainloop def notifications(bus, message): if message.get_member() == "event": args = message.get_args_list() if args[0] == "activate": print "hello world" activewindow = popen("xdotool getactivewindow getwindowname", stdout=pipe, stderr=pipe); print activewindow.communicate() dbusgmainloop(set_as_default=true) bus = dbus.sessionbus() bus.add_match_string_non_blocking("interface='org.kde.knotify',eavesdrop='true'") bus.add_message_filter(notifications) mainloop = glib.mainloop() mainloop.run()
however, apparently wrong popen call, , glib seems swallow error. @ least, on irc channel told me. when remove popen
, activewindow.communicate()
calls, keeps working , message "hello world!" printed in shell whenever switch new window.
with popen
, communicate()
calls, script prints single "hello world" , hangs after that.
does know:
- how can proper error message?
- what i'm doing wrong in
popen
call?
thanks in advance!
i can't comment... haven't imported process module, or members (popen, pipe).
Comments
Post a Comment