#!/usr/bin/env python
import os
bashCommand = "gsettings set org.gnome.desktop.background picture-uri file:///home/{me}/autowallpaperchanger/" + pic_name
print bashCommand
os.system(bashCommand)
打印结果:
gsettings set org.gnome.desktop.background picture-uri file:///home/{me}/autowallpaperchanger/wallpaper-1252048.jpg
将打印结果复制并粘贴到终端使更改成功,因此命令是正确的,但 os.system 由于某种原因没有正确处理请求。
谢谢!
编辑完整脚本: http: //pastebin.com/bUKYYrn1