From 1f8e08d168c5abfd08090f8bf77574de14e6c4d7 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Mon, 20 Jun 2016 01:37:17 -0400 Subject: [PATCH] replace raw_input with input from six.moves --- beets/ui/__init__.py | 5 +++-- beetsplug/bpm.py | 3 ++- docs/faq.rst | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index af7fe9aff..9cebf7a28 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -31,6 +31,7 @@ import re import struct import traceback import os.path +from six.moves import input from beets import logging from beets import library @@ -193,7 +194,7 @@ def should_move(move_opt=None): # Input prompts. def input_(prompt=None): - """Like `raw_input`, but decodes the result to a Unicode string. + """Like `input`, but decodes the result to a Unicode string. Raises a UserError if stdin is not available. The prompt is sent to stdout rather than stderr. A printed between the prompt and the input cursor. @@ -205,7 +206,7 @@ def input_(prompt=None): print_(prompt, end=' ') try: - resp = raw_input() + resp = input() except EOFError: raise UserError(u'stdin stream ended while input required') diff --git a/beetsplug/bpm.py b/beetsplug/bpm.py index ba284c042..89424f30e 100644 --- a/beetsplug/bpm.py +++ b/beetsplug/bpm.py @@ -18,6 +18,7 @@ from __future__ import division, absolute_import, print_function import time +from six.moves import input from beets import ui from beets.plugins import BeetsPlugin @@ -31,7 +32,7 @@ def bpm(max_strokes): dt = [] for i in range(max_strokes): # Press enter to the rhythm... - s = raw_input() + s = input() if s == '': t1 = time.time() # Only start measuring at the second stroke diff --git a/docs/faq.rst b/docs/faq.rst index 974b0dce6..ff74a5350 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -289,7 +289,7 @@ Also note that beets may take some time to quit after ^C is typed; it tries to clean up after itself briefly even when canceled. (For developers: this is because the UI thread is blocking on -``raw_input`` and cannot be interrupted by the main thread, which is +``input`` and cannot be interrupted by the main thread, which is trying to close all pipeline stages in the exception handler by setting a flag. There is no simple way to remedy this.)