fixed raw_input error for python 3

master
Vincent Zeng 2018-02-23 15:28:25 -05:00
parent 9546c67e0c
commit d71790fff6
2 changed files with 20 additions and 18 deletions

View File

@ -40,6 +40,7 @@ import time
import json import json
from email.mime.text import MIMEText from email.mime.text import MIMEText
import datetime import datetime
from six.moves import input
import inflect import inflect
@ -233,7 +234,7 @@ def check_init():
setup_repair() setup_repair()
else: else:
raw_input("press <enter> to explore your feels.\n\n") input("press <enter> to explore your feels.\n\n")
core.load(SETTINGS) core.load(SETTINGS)
@ -246,7 +247,7 @@ def init():
""" """
try: try:
raw_input(""" input("""
i don't recognize you, stranger. let's make friends. i don't recognize you, stranger. let's make friends.
press <enter> to begin, or <ctrl-c> to get out of here.""") press <enter> to begin, or <ctrl-c> to get out of here.""")
@ -296,7 +297,7 @@ press <enter> to begin, or <ctrl-c> to get out of here.""")
setup() setup()
core.load(SETTINGS) core.load(SETTINGS)
raw_input("\nyou're all good to go, "+chatter.say("friend")+"! hit <enter> to continue.\n\n") input("\nyou're all good to go, "+chatter.say("friend")+"! hit <enter> to continue.\n\n")
return "" return ""
def gen_header(): def gen_header():
@ -396,7 +397,7 @@ def setup_repair():
print("...") print("...")
time.sleep(1) time.sleep(1)
raw_input("\nyou're all good to go, "+chatter.say("friend")+"! hit <enter> to continue.\n\n") input("\nyou're all good to go, "+chatter.say("friend")+"! hit <enter> to continue.\n\n")
def setup(): def setup():
''' '''
@ -420,7 +421,7 @@ def setup():
util.print_menu(menuOptions, SETTINGS.get("rainbows", False)) util.print_menu(menuOptions, SETTINGS.get("rainbows", False))
try: try:
choice = raw_input("\npick a setting to change (or type 'q' to exit): ") choice = input("\npick a setting to change (or type 'q' to exit): ")
except KeyboardInterrupt: except KeyboardInterrupt:
redraw(EJECT) redraw(EJECT)
return SETTINGS return SETTINGS
@ -475,7 +476,7 @@ def setup():
save_settings() save_settings()
return setup() return setup()
raw_input("\nyou're all good to go, {friend}! hit <enter> to continue.\n\n".format(friend=chatter.say("friend"))) input("\nyou're all good to go, {friend}! hit <enter> to continue.\n\n".format(friend=chatter.say("friend")))
redraw() redraw()
return SETTINGS return SETTINGS
@ -511,7 +512,7 @@ def main_menu():
util.print_menu(menuOptions, SETTINGS.get("rainbows", False)) util.print_menu(menuOptions, SETTINGS.get("rainbows", False))
try: try:
choice = raw_input("\ntell me about your feels (or type 'q' to exit): ") choice = input("\ntell me about your feels (or type 'q' to exit): ")
except KeyboardInterrupt: except KeyboardInterrupt:
redraw(EJECT) redraw(EJECT)
return main_menu() return main_menu()
@ -571,12 +572,12 @@ def feedback_menu():
''' '''
util.print_menu(SUBJECTS, SETTINGS.get("rainbows", False)) util.print_menu(SUBJECTS, SETTINGS.get("rainbows", False))
choice = raw_input("\npick a category for your feedback: ") choice = input("\npick a category for your feedback: ")
cat = "" cat = ""
if choice in ['0', '1', '2', '3']: if choice in ['0', '1', '2', '3']:
cat = SUBJECTS[int(choice)] cat = SUBJECTS[int(choice)]
entered = raw_input(""" entered = input("""
composing a {mail_category} to ~endorphant. composing a {mail_category} to ~endorphant.
press <enter> to open an external text editor. mail will be sent once you save and quit. press <enter> to open an external text editor. mail will be sent once you save and quit.
@ -751,7 +752,7 @@ i'd love to hear about your ideas and brainstorm about new features!
thanks to everyone who reads, listens, writes, and feels.\ thanks to everyone who reads, listens, writes, and feels.\
""") """)
raw_input("\n\npress <enter> to go back home.\n\n") input("\n\npress <enter> to go back home.\n\n")
redraw() redraw()
return return
@ -763,7 +764,7 @@ def write_entry(entry=os.path.join(config.USER_DATA, "test.txt")):
main feels-recording handler main feels-recording handler
''' '''
entered = raw_input(""" entered = input("""
feels will be recorded for today, {today}. feels will be recorded for today, {today}.
if you've already started recording feels for this day, you if you've already started recording feels for this day, you
@ -972,7 +973,7 @@ wall will be recorded if you save the file, and you can cancel
your changes by exiting without saving. your changes by exiting without saving.
""") """)
raw_input("press <enter> to visit the wall\n\n") input("press <enter> to visit the wall\n\n")
subprocess.call([SETTINGS.get("editor"), config.WALL]) subprocess.call([SETTINGS.get("editor"), config.WALL])
subprocess.call(["rm", config.WALL_LOCK]) subprocess.call(["rm", config.WALL_LOCK])
redraw("thanks for visiting the graffiti wall!") redraw("thanks for visiting the graffiti wall!")
@ -1033,13 +1034,13 @@ def select_publish_dir():
print("\ncurrent publish dir:\t"+os.path.join(config.PUBLIC, SETTINGS["publish dir"])) print("\ncurrent publish dir:\t"+os.path.join(config.PUBLIC, SETTINGS["publish dir"]))
republish = True republish = True
choice = raw_input("\nwhere do you want your blog published? (leave blank to use default \"blog\") ") choice = input("\nwhere do you want your blog published? (leave blank to use default \"blog\") ")
if not choice: if not choice:
choice = "blog" choice = "blog"
publishDir = os.path.join(config.PUBLIC, choice) publishDir = os.path.join(config.PUBLIC, choice)
while os.path.exists(publishDir): while os.path.exists(publishDir):
second = raw_input("\n"+publishDir+"""\ second = input("\n"+publishDir+"""\
already exists! already exists!
setting this as your publishing directory means this program may setting this as your publishing directory means this program may
@ -1278,7 +1279,7 @@ something strange happened to you during this update.
confirm = "" confirm = ""
while confirm not in ("x", "<x>", "X", "<X>"): while confirm not in ("x", "<x>", "X", "<X>"):
confirm = raw_input("\nplease type <x> when you've finished reading about the updates! ") confirm = input("\nplease type <x> when you've finished reading about the updates! ")
open(versionFile, "w").write(__version__) open(versionFile, "w").write(__version__)

View File

@ -25,6 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
''' '''
import random import random
import time import time
from six.moves import input
import colorama import colorama
import inflect import inflect
@ -179,7 +180,7 @@ def list_select(options, prompt):
ans = "" ans = ""
invalid = True invalid = True
choice = raw_input("\n"+prompt) choice = input("\n"+prompt)
if choice in BACKS: if choice in BACKS:
return False return False
@ -205,11 +206,11 @@ def input_yn(query):
''' '''
try: try:
ans = raw_input(query+" [y/n] ") ans = input(query+" [y/n] ")
except KeyboardInterrupt: except KeyboardInterrupt:
input_yn(query) input_yn(query)
while ans not in ["y", "n"]: while ans not in ["y", "n"]:
ans = raw_input("'y' or 'n' please: ") ans = input("'y' or 'n' please: ")
return ans == "y" return ans == "y"