Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Merge pull request #150 from ixje/clarify_config_error
Browse files Browse the repository at this point in the history
Clarify config error message
  • Loading branch information
localhuman authored Jan 6, 2018
2 parents af9fa62 + c496a2e commit 09a989b
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@
from neo.Prompt.Commands.LoadSmartContract import LoadContract, GatherContractDetails, ImportContractAddr, \
ImportMultiSigContractAddr
from neo.Prompt.Commands.Send import construct_and_send, parse_and_sign
from neo.Prompt.Commands.Tokens import token_approve_allowance, token_get_allowance, token_send, token_send_from, token_mint, token_crowdsale_register
from neo.Prompt.Commands.Wallet import DeleteAddress, ImportWatchAddr, ImportToken, ClaimGas, DeleteToken, AddAlias, ShowUnspentCoins
from neo.Prompt.Commands.Tokens import token_approve_allowance, token_get_allowance, token_send, token_send_from, \
token_mint, token_crowdsale_register
from neo.Prompt.Commands.Wallet import DeleteAddress, ImportWatchAddr, ImportToken, ClaimGas, DeleteToken, AddAlias, \
ShowUnspentCoins
from neo.Prompt.Utils import get_arg
from neo.Settings import settings, DIR_PROJECT_ROOT
from neo.UserPreferences import preferences
from neo.Wallets.KeyPair import KeyPair

# Logfile settings & setup
LOGFILE_FN = os.path.join(DIR_PROJECT_ROOT, 'prompt.log')
LOGFILE_MAX_BYTES = 5e7 # 50 MB
LOGFILE_MAX_BYTES = 5e7 # 50 MB
LOGFILE_BACKUP_COUNT = 3 # 3 logfiles history
settings.set_logfile(LOGFILE_FN, LOGFILE_MAX_BYTES, LOGFILE_BACKUP_COUNT)

Expand All @@ -49,7 +51,6 @@


class PromptInterface(object):

go_on = True

_walletdb_loop = None
Expand Down Expand Up @@ -520,14 +521,14 @@ def show_tx(self, args):
try:
tx, height = Blockchain.Default().GetTransaction(item)
if height > -1:

bjson = json.dumps(tx.ToJson(), indent=4)
tokens = [(Token.Command, bjson)]
print_tokens(tokens, self.token_style)
print('\n')
except Exception as e:
print("Could not find transaction with id %s " % item)
print("Please specify a tx hash like 'db55b4d97cf99db6826967ef4318c2993852dff3e79ec446103f141c716227f6'")
print(
"Please specify a tx hash like 'db55b4d97cf99db6826967ef4318c2993852dff3e79ec446103f141c716227f6'")
else:
print("please specify a tx hash")

Expand Down Expand Up @@ -618,13 +619,15 @@ def test_invoke_contract(self, args):
tx, fee, results, num_ops = TestInvokeContract(self.Wallet, args)

if tx is not None and results is not None:
print("\n-------------------------------------------------------------------------------------------------------------------------------------")
print(
"\n-------------------------------------------------------------------------------------------------------------------------------------")
print("Test invoke successful")
print("Total operations: %s " % num_ops)
print("Results %s " % [str(item) for item in results])
print("Invoke TX gas cost: %s " % (tx.Gas.value / Fixed8.D))
print("Invoke TX Fee: %s " % (fee.value / Fixed8.D))
print("-------------------------------------------------------------------------------------------------------------------------------------\n")
print(
"-------------------------------------------------------------------------------------------------------------------------------------\n")
print("Enter your password to continue and invoke on the network\n")

passwd = prompt("[password]> ", is_password=True)
Expand Down Expand Up @@ -657,13 +660,15 @@ def load_smart_contract(self, args):
tx, fee, results, num_ops = test_invoke(contract_script, self.Wallet, [])

if tx is not None and results is not None:
print("\n-------------------------------------------------------------------------------------------------------------------------------------")
print(
"\n-------------------------------------------------------------------------------------------------------------------------------------")
print("Test deploy invoke successful")
print("Total operations executed: %s " % num_ops)
print("Results %s " % [str(item) for item in results])
print("Deploy Invoke TX gas cost: %s " % (tx.Gas.value / Fixed8.D))
print("Deploy Invoke TX Fee: %s " % (fee.value / Fixed8.D))
print("-------------------------------------------------------------------------------------------------------------------------------------\n")
print(
"-------------------------------------------------------------------------------------------------------------------------------------\n")
print("Enter your password to continue and deploy this contract")

passwd = prompt("[password]> ", is_password=True)
Expand Down Expand Up @@ -730,8 +735,8 @@ def configure(self, args):
print("cannot configure log. Please specify on or off")

else:
print("cannot configure %s " % what)
print("Try 'config log on/off'")
print("cannot configure %s", what)
print("Try 'config sc-events on|off' or 'config debug on|off'")

def parse_result(self, result):
if len(result):
Expand Down Expand Up @@ -841,7 +846,8 @@ def main():
help="Use PrivNet instead of the default TestNet")
parser.add_argument("-c", "--config", action="store", help="Use a specific config file")
parser.add_argument("-t", "--set-default-theme", dest="theme",
choices=["dark", "light"], help="Set the default theme to be loaded from the config file. Default: 'dark'")
choices=["dark", "light"],
help="Set the default theme to be loaded from the config file. Default: 'dark'")
parser.add_argument('--version', action='version',
version='neo-python v{version}'.format(version=__version__))

Expand Down

0 comments on commit 09a989b

Please sign in to comment.