hoping someone might be able to help a complete newbie here. I am connected to a terminal session in my pi zero via putty and Xming Server and have installed feh to inspect image files. so if I enter
sudo feh myimage.jpg
it launches a new x- window and shows the image perfectly over the remote connection on my laptop. So what I would like to do is have this run via a python script.
def displaylastimage(): if not os.path.exists(cameraproperties.lastimage): print("file not found") else: lastimagefilecmd = str("feh "+ cameraproperties.lastimage) try: os.system(lastimagefilecmd) #Try no1 os.system("DISPLAY=:0.0 XAUTHORITY=/home/pi/.Xauthority"+lastimagefilecmd) #Try no2 image = subprocess.Popen(["feh", cameraproperties.lastimage]) # try no3 subprocess.Popen(lastimagefilecmd, shell=True) #try no 4 except Exception as Er: print(Er) print("something went wrong") pass
Every time I get the same error:
PuTTY X11 proxy: Unsupported authorisation protocol Feh ERROR: Can't open X display. It *is* running, yeah?
I guessing that Feh is being called but the output is taking a different route when called from python? Any suggestions about how one might go about fixing this? Thanks.