I have found the code to find the last file saved in a folder, but I need to open this file for x amount of time, then close it. Can this be done?
Here is the code I am using to find the latest .jpg
import glob
import os
list_of_files = glob.glob('/home/pi/webcam/*.jpg')
latest_file = max(list_of_files, key=os.path.getctime)
print latest_file
I have tried the following, the code runs but nothing happens:
from PIL import Image
import glob
import os
list_of_files = glob.glob('/path/to/folder/*.jpg')
latest_file = max(list_of_files, key=os.path.getctime)
img = Image.open(latest_file)
img.show()
I am trying to build this into booth.py
Here is my attempt so far (with below suggestions)
I found these codes on Stack Overflow