开发者

DBus Python Problems

开发者 https://www.devze.com 2022-12-10 09:00 出处:网络
When I\'m trying to get the idle time of the gnome screensaver in seconds, through dbus, python throws an TypeError.

When I'm trying to get the idle time of the gnome screensaver in seconds, through dbus, python throws an TypeError.

In the documentation I found for the screensaver sessionIdleTime, it returns a unsigned integer. http://www.gnome.org/~mccann/gnome-screensaver/docs/gnome-screensaver.html#gs-method-GetSessionIdle

However, when I'开发者_运维技巧m in the python shell, the output is converterted to a string, while I can't seen to be able to cast it as a string in the program.

gs = gs = bus.get_object('org.gnome.ScreenSaver','/org/gnome/ScreenSaver') message = str(gs.GetSessionIdleTime())


str(gs.GetSessionIdleTime()) cast the integer into a string.

And after that, using + in a string variable incorporated it into another dbus call that was called by the output.

0

精彩评论

暂无评论...
验证码 换一张
取 消