I'm writing a Python script where part of its function is to find the last modified file of a specific kind. In my case, it's for the last modified screen saver plist file on Mac OS X. Below are the bits of code which deal with this:
import os
PlistFolder = "Library/Preferences/ByHost"
MacPlistPath = os.path.join(HomeFolder, PlistFolder)
PlistSSMac = max([f for f in os.listdir(MacPlistPath) if f.lower().endswith('.plist') and f.lower().startswith('com.apple.screensaver.')], key=os.path.getmtime)
When I run it, however, it gives me an error while returning exactly what I wanted it to find...
Traceback (most recent call last):
File "tcn_test.py", line 29, in
MacPlistFile = max([f for f in os.listdir(MacPlistPath) if f.lower().endswith('.plist') and f.lower().startswith(