开发者

DBus Python Problems

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜