Skip to content

Commit

Permalink
Fix input errors on py2/3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZonnCash committed Nov 20, 2017
1 parent 5f60b37 commit a6274f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 5 additions & 6 deletions lib/init.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from builtins import input
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
Expand Down Expand Up @@ -82,31 +83,29 @@ def has_desire_conf():
def main():
install_instructions = "\tpip install -r requirements.txt"

wait = getattr(__builtins__, 'raw_input', input)

if not is_valid_python_version():
print("Python %s is not supported" % python_short_ver_str())

wait('Press [ENTER] to exit')
input('Press [ENTER] to exit')
sys.exit(1)

if not are_deps_installed():
print("Please ensure all dependencies are installed:")
print(install_instructions)

wait('Press [ENTER] to exit')
input('Press [ENTER] to exit')
sys.exit(1)

if not is_database_correctly_configured():
print("Please ensure correct database configuration.")

wait('Press [ENTER] to exit')
input('Press [ENTER] to exit')
sys.exit(1)

if not has_desire_conf():
print("DesireCore must be installed and configured, including JSONRPC access in desire.conf")

wait('Press [ENTER] to exit')
input('Press [ENTER] to exit')
sys.exit(1)


Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import logging
import traceback

from builtins import input
from colorama import init
from termcolor import colored
from pynput import keyboard
Expand Down Expand Up @@ -47,11 +48,11 @@ def fix_masternode(data_folder):
wallet_file = os.path.join(data_folder, 'wallet.dat')

if not os.path.isfile(wallet_file):
print('It seems like the data folder (the one containing wallet.data) is not the same as the folder where desire.conf is')
print('It seems like the data folder (the one containing wallet.dat) is not the same as the folder where desire.conf is')
data_folder = input('Please, write the data folder path: ')
return fix_masternode(data_folder)

print(colored('Make a copy of "wallet.data" and "desire.conf" before continuing.\nThis program will try it best not to touch them, but just in case!', attrs=['bold']))
print(colored('Make a copy of "wallet.dat" and "desire.conf" before continuing.\nThis program will try it best not to touch them, but just in case!', attrs=['bold']))
confirm = input('Once done, press [ENTER], or write cancel + [ENTER] to exit\n')
if confirm.lower() == "cancel":
return
Expand Down

0 comments on commit a6274f6

Please sign in to comment.