]> git.phdru.name Git - m_lib.git/commitdiff
Fix raw_input for Py3 compatibility
authorOleg Broytman <phd@phdru.name>
Mon, 25 Jul 2016 16:05:26 +0000 (19:05 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 25 Jul 2016 17:26:50 +0000 (20:26 +0300)
m_lib/mcrypt.py
m_lib/tty_menu.py

index 03aa7f6f8d0937d4407de5ed3828031690b914f4..13357371147af122e0f08d1880ff6295a95318b0 100755 (executable)
@@ -26,6 +26,11 @@ def gen_salt():
 
 
 def test():
+   try:
+      raw_input
+   except NameError:  # Python 3
+      raw_input = input
+
    passwd = raw_input("Enter password: ")
    salt = gen_salt()
    encrypted = crypt.crypt(passwd, salt)
index 897ecc9a8b2764ef02c1db51f4f03bbaef39152d..06e756e157c78edf2883976da04629bc3576ccdb 100755 (executable)
@@ -6,6 +6,12 @@ from __future__ import print_function
 import string
 
 
+try:
+   raw_input
+except NameError:  # Python 3
+   raw_input = input
+
+
 def hmenu(prompt, astring):
    """
       Writes prompt and read result