2525import shutil
2626import sys
2727
28- from IPython .config .configurable import Configurable
28+ from IPython .config .configurable import LoggingConfigurable
2929from IPython .config .loader import Config
3030from IPython .utils .path import get_ipython_package_dir , expand_path
3131from IPython .utils .traitlets import List , Unicode , Bool
@@ -47,7 +47,7 @@ class ProfileDirError(Exception):
4747# Class for managing profile directories
4848#-----------------------------------------------------------------------------
4949
50- class ProfileDir (Configurable ):
50+ class ProfileDir (LoggingConfigurable ):
5151 """An object to manage the profile directory and its resources.
5252
5353 The profile directory is used by all IPython applications, to manage
@@ -98,7 +98,10 @@ def check_security_dir(self):
9898 if not os .path .isdir (self .security_dir ):
9999 os .mkdir (self .security_dir , 0700 )
100100 else :
101- os .chmod (self .security_dir , 0700 )
101+ try :
102+ os .chmod (self .security_dir , 0700 )
103+ except OSError :
104+ self .log .warn ("Could not set security dir permissions to private." )
102105
103106 def _pid_dir_changed (self , name , old , new ):
104107 self .check_pid_dir ()
@@ -107,7 +110,10 @@ def check_pid_dir(self):
107110 if not os .path .isdir (self .pid_dir ):
108111 os .mkdir (self .pid_dir , 0700 )
109112 else :
110- os .chmod (self .pid_dir , 0700 )
113+ try :
114+ os .chmod (self .pid_dir , 0700 )
115+ except OSError :
116+ self .log .warn ("Could not set pid dir permissions to private." )
111117
112118 def check_dirs (self ):
113119 self .check_security_dir ()
0 commit comments