python: Use os.path.isdir(p) rather than p.isdir()

The latter is broken with Python 2.7 on Windows.