##// END OF EJS Templates
Search for first existing directory, if cwd doesn't exist....
Thomas Spura -
Show More
@@ -146,6 +146,20 b' class BaseIPythonApplication(Application):'
146
146
147 def __init__(self, **kwargs):
147 def __init__(self, **kwargs):
148 super(BaseIPythonApplication, self).__init__(**kwargs)
148 super(BaseIPythonApplication, self).__init__(**kwargs)
149 # ensure current working directory exists
150 level_up = False
151 while True:
152 try:
153 directory = os.getcwdu()
154 except OSError:
155 # search level up until directory exists
156 os.chdir("..")
157 level_up = True
158 else:
159 if level_up:
160 self.log.warn("Current working directory doesn't exist.\nSetting to: %s"%(directory))
161 break
162
149 # ensure even default IPYTHONDIR exists
163 # ensure even default IPYTHONDIR exists
150 if not os.path.exists(self.ipython_dir):
164 if not os.path.exists(self.ipython_dir):
151 self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir)
165 self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir)
General Comments 0
You need to be logged in to leave comments. Login now