Find an existing profile dir by profile name, return its ProfileDir. This searches through a sequence of paths for a profile dir. If it is not found, a :class:`ProfileDirError` exception will be raised. The search path algorithm is: 1. ``os.getcwd()`` 2. ``
(cls, ipython_dir, name=u'default', config=None)
| 180 | |
| 181 | @classmethod |
| 182 | def find_profile_dir_by_name(cls, ipython_dir, name=u'default', config=None): |
| 183 | """Find an existing profile dir by profile name, return its ProfileDir. |
| 184 | |
| 185 | This searches through a sequence of paths for a profile dir. If it |
| 186 | is not found, a :class:`ProfileDirError` exception will be raised. |
| 187 | |
| 188 | The search path algorithm is: |
| 189 | 1. ``os.getcwd()`` |
| 190 | 2. ``ipython_dir`` |
| 191 | |
| 192 | Parameters |
| 193 | ---------- |
| 194 | ipython_dir : unicode or str |
| 195 | The IPython directory to use. |
| 196 | name : unicode or str |
| 197 | The name of the profile. The name of the profile directory |
| 198 | will be "profile_<profile>". |
| 199 | """ |
| 200 | dirname = u'profile_' + name |
| 201 | paths = [os.getcwd(), ipython_dir] |
| 202 | for p in paths: |
| 203 | profile_dir = os.path.join(p, dirname) |
| 204 | if os.path.isdir(profile_dir): |
| 205 | return cls(location=profile_dir, config=config) |
| 206 | else: |
| 207 | raise ProfileDirError('Profile directory not found in paths: %s' % dirname) |
| 208 | |
| 209 | @classmethod |
| 210 | def find_profile_dir(cls, profile_dir, config=None): |