Replaced os.getmtime with os.path.getmtime as pointed out by @5225225