diff --git a/IPython/core/crashhandler.py b/IPython/core/crashhandler.py index 1d405cf..8d0f54b 100644 --- a/IPython/core/crashhandler.py +++ b/IPython/core/crashhandler.py @@ -28,6 +28,7 @@ from pprint import pformat from IPython.core import ultratb from IPython.core.release import author_email from IPython.utils.sysinfo import sys_info +from IPython.utils.py3compat import input #----------------------------------------------------------------------------- # Code @@ -176,7 +177,7 @@ class CrashHandler(object): # Construct report on disk report.write(self.make_report(traceback)) report.close() - raw_input("Hit to quit (your terminal may close):") + input("Hit to quit (your terminal may close):") def make_report(self,traceback): """Return a string containing a crash report.""" diff --git a/IPython/core/page.py b/IPython/core/page.py index 67cde95..e0aebd2 100644 --- a/IPython/core/page.py +++ b/IPython/core/page.py @@ -314,7 +314,7 @@ if os.name == 'nt' and os.environ.get('TERM','dumb') != 'emacs': return result else: def page_more(): - ans = raw_input('---Return to continue, q to quit--- ') + ans = py3compat.input('---Return to continue, q to quit--- ') if ans.lower().startswith('q'): return False else: @@ -345,6 +345,6 @@ def snip_print(str,width = 75,print_full = 0,header = ''): print(str[:whalf] + ' <...> ' + str[-whalf:]) snip = 1 if snip and print_full == 2: - if raw_input(header+' Snipped. View (y/n)? [N]').lower() == 'y': + if py3compat.input(header+' Snipped. View (y/n)? [N]').lower() == 'y': page(str) return snip diff --git a/IPython/core/tests/test_inputsplitter.py b/IPython/core/tests/test_inputsplitter.py index 2b02b93..6fe47d4 100644 --- a/IPython/core/tests/test_inputsplitter.py +++ b/IPython/core/tests/test_inputsplitter.py @@ -29,7 +29,7 @@ from IPython.core import inputsplitter as isp from IPython.core.tests.test_inputtransformer import syntax, syntax_ml from IPython.testing import tools as tt from IPython.utils import py3compat -from IPython.utils.py3compat import string_types +from IPython.utils.py3compat import string_types, input #----------------------------------------------------------------------------- # Semi-complete examples (also used as tests) @@ -489,9 +489,9 @@ if __name__ == '__main__': while isp.push_accepts_more(): indent = ' '*isp.indent_spaces if autoindent: - line = indent + raw_input(prompt+indent) + line = indent + input(prompt+indent) else: - line = raw_input(prompt) + line = input(prompt) isp.push(line) prompt = '... ' diff --git a/IPython/lib/demo.py b/IPython/lib/demo.py index c0b4787..f5c6bc3 100644 --- a/IPython/lib/demo.py +++ b/IPython/lib/demo.py @@ -186,6 +186,7 @@ import sys from IPython.utils import io from IPython.utils.text import marquee from IPython.utils import openpy +from IPython.utils import py3compat __all__ = ['Demo','IPythonDemo','LineDemo','IPythonLineDemo','DemoError'] class DemoError(Exception): pass @@ -449,7 +450,7 @@ class Demo(object): print(marquee('output:'), file=io.stdout) else: print(marquee('Press to quit, to execute...'), end=' ', file=io.stdout) - ans = raw_input().strip() + ans = py3compat.input().strip() if ans: print(marquee('Block NOT executed'), file=io.stdout) return diff --git a/IPython/lib/editorhooks.py b/IPython/lib/editorhooks.py index 7f98a6a..2237074 100644 --- a/IPython/lib/editorhooks.py +++ b/IPython/lib/editorhooks.py @@ -12,6 +12,7 @@ import subprocess from IPython import get_ipython from IPython.core.error import TryNext +from IPython.utils import py3compat def install_editor(template, wait=False): @@ -51,7 +52,7 @@ def install_editor(template, wait=False): if wait and proc.wait() != 0: raise TryNext() if wait: - raw_input("Press Enter when done editing:") + py3compat.input("Press Enter when done editing:") get_ipython().set_hook('editor', call_editor) get_ipython().editor = template diff --git a/IPython/terminal/console/interactiveshell.py b/IPython/terminal/console/interactiveshell.py index 9c32317..902c6d5 100644 --- a/IPython/terminal/console/interactiveshell.py +++ b/IPython/terminal/console/interactiveshell.py @@ -31,7 +31,7 @@ except ImportError: from IPython.core import page from IPython.utils.warn import warn, error from IPython.utils import io -from IPython.utils.py3compat import string_types +from IPython.utils.py3compat import string_types, input from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode, Float from IPython.utils.tempdir import NamedFileInTemporaryDirectory @@ -330,7 +330,7 @@ class ZMQTerminalInteractiveShell(TerminalInteractiveShell): signal.signal(signal.SIGINT, double_int) try: - raw_data = raw_input(msg_rep["content"]["prompt"]) + raw_data = input(msg_rep["content"]["prompt"]) except EOFError: # turn EOFError into EOF character raw_data = '\x04' diff --git a/IPython/utils/io.py b/IPython/utils/io.py index 60ed1c2..46296be 100644 --- a/IPython/utils/io.py +++ b/IPython/utils/io.py @@ -18,7 +18,7 @@ import os import sys import tempfile from .capture import CapturedIO, capture_output -from .py3compat import string_types +from .py3compat import string_types, input #----------------------------------------------------------------------------- # Code @@ -170,7 +170,7 @@ def ask_yes_no(prompt,default=None): ans = None while ans not in answers.keys(): try: - ans = raw_input(prompt+' ').lower() + ans = input(prompt+' ').lower() if not ans: # response was an empty string ans = default except KeyboardInterrupt: