import os.path script_dir = os.path.dirname(os.path.abspath(__file__)) im = Image.open(os.path.join(script_dir, 'Desert.jpg')) # OR im = Image.open(os.path.join(script_dir, '../assets/Desert.jpg'))