(self, change)
| 264 | |
| 265 | @observe('ipython_dir') |
| 266 | def _ipython_dir_changed(self, change): |
| 267 | old = change['old'] |
| 268 | new = change['new'] |
| 269 | if old is not Undefined: |
| 270 | str_old = os.path.abspath(old) |
| 271 | if str_old in sys.path: |
| 272 | sys.path.remove(str_old) |
| 273 | str_path = os.path.abspath(new) |
| 274 | sys.path.append(str_path) |
| 275 | ensure_dir_exists(new) |
| 276 | readme = os.path.join(new, 'README') |
| 277 | readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README') |
| 278 | if not os.path.exists(readme) and os.path.exists(readme_src): |
| 279 | shutil.copy(readme_src, readme) |
| 280 | for d in ('extensions', 'nbextensions'): |
| 281 | path = os.path.join(new, d) |
| 282 | try: |
| 283 | ensure_dir_exists(path) |
| 284 | except OSError as e: |
| 285 | # this will not be EEXIST |
| 286 | self.log.error("couldn't create path %s: %s", path, e) |
| 287 | self.log.debug("IPYTHONDIR set to: %s" % new) |
| 288 | |
| 289 | def load_config_file(self, suppress_errors=IPYTHON_SUPPRESS_CONFIG_ERRORS): |
| 290 | """Load the config file. |
no test coverage detected