You are not logged in.
Pages: 1
I'm writing a script that will select a new wallpaper periodically like in Windows 7. Running into some trouble, though.
def setbg(images):
imgnum = random.randint(0, len(images))
command = ['-fill', images[imgnum] ]
#print(command[0] + ' ' + command[1])
execvp('hsetroot', command)
I keep getting hsetroot's usage screen. I'm not sure why; when I print out the args they look correct to me.
Last edited by Bellum (2012-05-03 04:24:13)
Offline
You need to provide a dummy first parameter.
Try:
command = ['', '-fill', images[imgnum] ]
execvp('hsetroot', command)
Offline
Ah, thanks, that worked correctly. Then I immediately discovered that of course execvp does not return.
subprocess.call was what I was looking for. Incidentally, I've got to say pythons documentation is great. I don't even really know python , but I was able to churn out this script in no time.
Offline
Pages: 1