Aug-13-2020, 12:01 PM
When you pass the path variable to os.chdir(), you need it to be a valid directory like 'C:\TMP'. When you pass the path variable to glob.glob() (lines 18 and 36), you need it to include a wildcard like 'C:\TMP\*'. My guess is you are passing path without a wildcard in lines 18 and 36, so your glob.glob() loop is not actually finding anything that satisfies the if condition (nothing that ends with .jpg or .png).
import glob print('Printing items using C:\TMP as path') for item in glob.glob('C:\TMP'): print(item) print('Printing items using C:\TMP\* as path') for item in glob.glob('C:\TMP\*'): print(item)
Output:Printing items using C:\TMP as path
C:\TMP
Printing items using C:\TMP\* as path
C:\TMP\Testing.jpg
C:\TMP\Placeholder.jpg