##// END OF EJS Templates
IPython/utils/path.py: If `os.path.exists` cannot handle a `unicode` path, as has been found in some cases, go ahead and convert to a `byte` path, which is hopefully supported.
John Kirkham -
Show More
@@ -437,6 +437,13 def ensure_dir_exists(path, mode=0o755):
437
437
438 The default permissions are 755, which differ from os.makedirs default of 777.
438 The default permissions are 755, which differ from os.makedirs default of 777.
439 """
439 """
440 path_exists = False
441 try:
442 path_exists = os.path.exists(path)
443 except UnicodeEncodeError:
444 path = path.encode("utf8")
445 path_exists = os.path.exists(path)
446
440 if not os.path.exists(path):
447 if not os.path.exists(path):
441 try:
448 try:
442 os.makedirs(path, mode=mode)
449 os.makedirs(path, mode=mode)
General Comments 0
You need to be logged in to leave comments. Login now