Show More
@@ -24,6 +24,7 b' Authors:' | |||
|
24 | 24 | import os |
|
25 | 25 | import shutil |
|
26 | 26 | import errno |
|
27 | import time | |
|
27 | 28 | |
|
28 | 29 | from IPython.config.configurable import LoggingConfigurable |
|
29 | 30 | from IPython.utils.path import get_ipython_package_dir, expand_path |
@@ -79,8 +80,16 b' class ProfileDir(LoggingConfigurable):' | |||
|
79 | 80 | if self._location_isset: |
|
80 | 81 | raise RuntimeError("Cannot set profile location more than once.") |
|
81 | 82 | self._location_isset = True |
|
82 | if not os.path.isdir(new): | |
|
83 | num_tries = 0 | |
|
84 | max_tries = 5 | |
|
85 | while not os.path.isdir(new): | |
|
86 | try: | |
|
83 | 87 | os.makedirs(new) |
|
88 | except OSError: | |
|
89 | if num_tries > max_tries: | |
|
90 | raise | |
|
91 | num_tries += 1 | |
|
92 | time.sleep(0.5) | |
|
84 | 93 | |
|
85 | 94 | # ensure config files exist: |
|
86 | 95 | self.security_dir = os.path.join(new, self.security_dir_name) |
@@ -270,5 +279,3 b' class ProfileDir(LoggingConfigurable):' | |||
|
270 | 279 | if not os.path.isdir(profile_dir): |
|
271 | 280 | raise ProfileDirError('Profile directory not found: %s' % profile_dir) |
|
272 | 281 | return cls(location=profile_dir, config=config) |
|
273 | ||
|
274 |
General Comments 0
You need to be logged in to leave comments.
Login now