Use os.path.isdir instead of os.path.exists.
Bugfix when printing json response with non ascii chars.