/usr/lib/python2.7/dist-packages/jupyter_core/utils/__init__.py is in python-jupyter-core 4.4.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import errno
import os
def ensure_dir_exists(path, mode=0o777):
"""ensure that a directory exists
If it doesn't exist, try to create it, protecting against a race condition
if another process is doing the same.
The default permissions are determined by the current umask.
"""
try:
os.makedirs(path, mode=mode)
except OSError as e:
if e.errno != errno.EEXIST:
raise
if not os.path.isdir(path):
raise IOError("%r exists but is not a directory" % path)
|