-#!/usr/bin/env python2
+#!/usr/bin/env python3
# Copyright 2008 Greg Darke <greg@tsukasa.net.au>
# Copyright 2008 James Bunton <jamesbunton@fastmail.fm>
# Licensed for distribution under the GPL version 2, check COPYING for details
# This is a cross platform/cross window manager way to change your wallpaper
-import commands, sys, os, os.path, time
+import subprocess, sys, os, os.path, time
import logging
try:
import PIL, PIL.Image
logging.warning("Failed to set background: wallchanger.set_image(%s), changer=%s", filename, changer)
def check_cmd(cmd):
- return commands.getstatusoutput(cmd)[0] == 0
+ return subprocess.getstatusoutput(cmd)[0] == 0
def init(*args, **kwargs):
"""Desktop Changer factory"""
return False
cmd = """osascript -e 'tell application "finder" to set desktop picture to posix file "%s"'""" % filename
logging.debug(cmd)
- return not commands.getstatusoutput(cmd)[0]
+ return not subprocess.getstatusoutput(cmd)[0]
class WIN32Changer(BaseChanger):
name = "Windows"
try:
filename = sys.argv[1]
except:
- print >>sys.stderr, "Usage: %s filename" % sys.argv[0]
+ print("Usage: %s filename" % sys.argv[0], file=sys.stderr)
sys.exit(1)
main(filename)