Show More
@@ -211,9 +211,15 b' class BaseIPythonApplication(Application):' | |||
|
211 | 211 | return crashhandler.crash_handler_lite(etype, evalue, tb) |
|
212 | 212 | |
|
213 | 213 | def _ipython_dir_changed(self, name, old, new): |
|
214 | if old in sys.path: | |
|
215 |
sys. |
|
|
216 | sys.path.append(os.path.abspath(new)) | |
|
214 | str_old = py3compat.cast_bytes_py2(os.path.abspath(old), | |
|
215 | sys.getfilesystemencoding() | |
|
216 | ) | |
|
217 | if str_old in sys.path: | |
|
218 | sys.path.remove(str_old) | |
|
219 | str_path = py3compat.cast_bytes_py2(os.path.abspath(new), | |
|
220 | sys.getfilesystemencoding() | |
|
221 | ) | |
|
222 | sys.path.append(str_path) | |
|
217 | 223 | if not os.path.isdir(new): |
|
218 | 224 | os.makedirs(new, mode=0o777) |
|
219 | 225 | readme = os.path.join(new, 'README') |
@@ -20,6 +20,8 b' Authors:' | |||
|
20 | 20 | |
|
21 | 21 | import sys |
|
22 | 22 | |
|
23 | from IPython.utils.py3compat import cast_bytes_py2 | |
|
24 | ||
|
23 | 25 | #----------------------------------------------------------------------------- |
|
24 | 26 | # Code |
|
25 | 27 | #----------------------------------------------------------------------------- |
@@ -28,7 +30,7 b' class appended_to_syspath(object):' | |||
|
28 | 30 | """A context for appending a directory to sys.path for a second.""" |
|
29 | 31 | |
|
30 | 32 | def __init__(self, dir): |
|
31 | self.dir = dir | |
|
33 | self.dir = cast_bytes_py2(dir, sys.getdefaultencoding()) | |
|
32 | 34 | |
|
33 | 35 | def __enter__(self): |
|
34 | 36 | if self.dir not in sys.path: |
@@ -50,7 +52,7 b' class prepended_to_syspath(object):' | |||
|
50 | 52 | """A context for prepending a directory to sys.path for a second.""" |
|
51 | 53 | |
|
52 | 54 | def __init__(self, dir): |
|
53 | self.dir = dir | |
|
55 | self.dir = cast_bytes_py2(dir, sys.getdefaultencoding()) | |
|
54 | 56 | |
|
55 | 57 | def __enter__(self): |
|
56 | 58 | if self.dir not in sys.path: |
General Comments 0
You need to be logged in to leave comments.
Login now