diff --git a/dispense_add.py b/dispense_add.py index 01f4e3175b6bef6ef142b4ec6441b313c3a3648f..03844783f61fa64f60a998f5aff4de749c5729e3 100755 --- a/dispense_add.py +++ b/dispense_add.py @@ -1,12 +1,10 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import subprocess as sp - - while True: username=None while(not(username)): - username = raw_input("Username: ") + username = input("Username: ") try: sp.check_call(["dispense","acct", username]) #sp.check_call(["id", username]) @@ -20,15 +18,15 @@ while True: int_amount = None while(not amount): try: - int_amount = int(raw_input("Amount (in cents): ")) + int_amount = int(input("Amount (in cents): ")) amount = "+"+str(int_amount) except ValueError: - print "Please enter a number." + print("Please enter a number.") amount = None continue - print "Adding: $%2.2f" % (int_amount/100.0) + print("Adding: $%2.2f" % (int_amount/100.0)) - reason = raw_input('Reason/Bag Number (Enter just a digit, to say "money in safe. Bag number <input>"): ') + reason = input('Reason/Bag Number (Enter just a digit, to say "money in safe. Bag number <input>"): ') if reason.isdigit(): reason = "Money in safe. Bag number " + reason elif len(reason)==0: @@ -37,9 +35,9 @@ while True: cmd =" ".join(['dispense acct ',username, amount,' "' + reason+'"']) - print "Will call: " + cmd + print("Will call: " + cmd) - confirm = raw_input("Correct (Y/N): ").lower() + confirm = input("Correct (Y/N): ").lower() if confirm and confirm[0]=='n': #Restart continue @@ -50,7 +48,7 @@ while True: #subprocess call hastes me for not useing speratre args sp.call(["dispense", "acct", username, amount, reason]) -print "Thankyou please remember to do what ever crazy plan the treasurer wants done with the safe today." +print("Thankyou please remember to do what ever crazy plan the treasurer wants done with the safe today.") diff --git a/dispense_refund.py b/dispense_refund.py index aee4828301f56651e8fcd75f76e363136a63b5ad..ca16fd9c8f7c2aabdd63c25894335bbb41793023 100755 --- a/dispense_refund.py +++ b/dispense_refund.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 import subprocess as sp sp.call(['tail', '-n5', "/home/other/coke/cokelog"]) username=None while(not(username)): - username = raw_input("Username: ") + username = input("Username: ") try: sp.check_call(["dispense","acct", username]) #sp.check_call(["id", username]) @@ -17,31 +17,31 @@ while(not(username)): item_id=None while(not(item_id)): - item_id = raw_input("item_id (Usually of the form <item>:<slot> eg coke:6 or snack:33): ") + item_id = input("item_id (Usually of the form <item>:<slot> eg coke:6 or snack:33): ") amount=None while(True): - raw_amount = raw_input("Amount (in cents): (Leave blank for default): ") + raw_amount = input("Amount (in cents): (Leave blank for default): ") if len(raw_amount)==0: amount="" - print "Refunding at default value" + print("Refunding at default value") break else: try: int_amount = int(raw_amount) #Throw the exception amount = str(int_amount) except ValueError: - print "Please enter a number." + print("Please enter a number.") continue - print "Refunding: $%2.2f" % (int_amount/100.0) + print("Refunding: $%2.2f" % (int_amount/100.0)) break cmd =" ".join(['dispense refund ',username, item_id, amount ]) -print "Will call: " + cmd +print("Will call: " + cmd) command_args = ["dispense","refund", username, item_id] if amount: - command_args.add(amount) + command_args.append(amount) sp.check_call(command_args) print("Done. Please Don't Make Mistakes Again.")