Show More
@@ -260,14 +260,10 b' class BaseIPythonApplication(Application):' | |||
|
260 | 260 | old = change['old'] |
|
261 | 261 | new = change['new'] |
|
262 | 262 | if old is not Undefined: |
|
263 |
str_old = |
|
|
264 | sys.getfilesystemencoding() | |
|
265 | ) | |
|
263 | str_old = os.path.abspath(old) | |
|
266 | 264 | if str_old in sys.path: |
|
267 | 265 | sys.path.remove(str_old) |
|
268 |
str_path = |
|
|
269 | sys.getfilesystemencoding() | |
|
270 | ) | |
|
266 | str_path = os.path.abspath(new) | |
|
271 | 267 | sys.path.append(str_path) |
|
272 | 268 | ensure_dir_exists(new) |
|
273 | 269 | readme = os.path.join(new, 'README') |
@@ -18,7 +18,7 b' import struct' | |||
|
18 | 18 | import sys |
|
19 | 19 | import warnings |
|
20 | 20 | |
|
21 |
from IPython.utils.py3compat import |
|
|
21 | from IPython.utils.py3compat import cast_unicode | |
|
22 | 22 | from IPython.testing.skipdoctest import skip_doctest |
|
23 | 23 | |
|
24 | 24 | __all__ = ['display', 'display_pretty', 'display_html', 'display_markdown', |
@@ -596,7 +596,6 b' class SVG(DisplayObject):' | |||
|
596 | 596 | return |
|
597 | 597 | # parse into dom object |
|
598 | 598 | from xml.dom import minidom |
|
599 | svg = cast_bytes_py2(svg) | |
|
600 | 599 | x = minidom.parseString(svg) |
|
601 | 600 | # get svg tag (should be 1) |
|
602 | 601 | found_svg = x.getElementsByTagName('svg') |
@@ -887,7 +887,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
887 | 887 | main_mod = self._main_mod_cache[filename] |
|
888 | 888 | except KeyError: |
|
889 | 889 | main_mod = self._main_mod_cache[filename] = types.ModuleType( |
|
890 |
|
|
|
890 | modname, | |
|
891 | 891 | doc="Module created for script run in IPython") |
|
892 | 892 | else: |
|
893 | 893 | main_mod.__dict__.clear() |
@@ -1875,7 +1875,7 b' class InteractiveShell(SingletonConfigurable):' | |||
|
1875 | 1875 | In [1]: _ip.set_next_input("Hello Word") |
|
1876 | 1876 | In [2]: Hello Word_ # cursor is here |
|
1877 | 1877 | """ |
|
1878 |
self.rl_next_input = |
|
|
1878 | self.rl_next_input = s | |
|
1879 | 1879 | |
|
1880 | 1880 | def _indent_current_str(self): |
|
1881 | 1881 | """return the current level of indentation as a string""" |
@@ -428,7 +428,7 b' class OSMagics(Magics):' | |||
|
428 | 428 | err = "refusing to set env var with whitespace: '{0}'" |
|
429 | 429 | err = err.format(val) |
|
430 | 430 | raise UsageError(err) |
|
431 | os.environ[py3compat.cast_bytes_py2(var)] = py3compat.cast_bytes_py2(val) | |
|
431 | os.environ[var] = val | |
|
432 | 432 | print('env: {0}={1}'.format(var,val)) |
|
433 | 433 | |
|
434 | 434 | @line_magic |
@@ -231,8 +231,7 b' def pager_page(strng, start=0, screen_lines=0, pager_cmd=None):' | |||
|
231 | 231 | pager = os.popen(pager_cmd, 'w') |
|
232 | 232 | try: |
|
233 | 233 | pager_encoding = pager.encoding or sys.stdout.encoding |
|
234 |
pager.write( |
|
|
235 | strng, encoding=pager_encoding)) | |
|
234 | pager.write(strng) | |
|
236 | 235 | finally: |
|
237 | 236 | retval = pager.close() |
|
238 | 237 | except IOError as msg: # broken pipe when user quits |
@@ -14,23 +14,14 b' Authors:' | |||
|
14 | 14 | # the file COPYING, distributed as part of this software. |
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | #----------------------------------------------------------------------------- | |
|
18 | # Imports | |
|
19 | #----------------------------------------------------------------------------- | |
|
20 | ||
|
21 | 17 | import sys |
|
22 | 18 | |
|
23 | from IPython.utils.py3compat import cast_bytes_py2 | |
|
24 | ||
|
25 | #----------------------------------------------------------------------------- | |
|
26 | # Code | |
|
27 | #----------------------------------------------------------------------------- | |
|
28 | 19 | |
|
29 | 20 | class appended_to_syspath(object): |
|
30 | 21 | """A context for appending a directory to sys.path for a second.""" |
|
31 | 22 | |
|
32 | 23 | def __init__(self, dir): |
|
33 | self.dir = cast_bytes_py2(dir, sys.getdefaultencoding()) | |
|
24 | self.dir = dir | |
|
34 | 25 | |
|
35 | 26 | def __enter__(self): |
|
36 | 27 | if self.dir not in sys.path: |
@@ -52,7 +43,7 b' class prepended_to_syspath(object):' | |||
|
52 | 43 | """A context for prepending a directory to sys.path for a second.""" |
|
53 | 44 | |
|
54 | 45 | def __init__(self, dir): |
|
55 | self.dir = cast_bytes_py2(dir, sys.getdefaultencoding()) | |
|
46 | self.dir = dir | |
|
56 | 47 | |
|
57 | 48 | def __enter__(self): |
|
58 | 49 | if self.dir not in sys.path: |
General Comments 0
You need to be logged in to leave comments.
Login now