spesmilo / spesmilo/electrum

CLI: add_request breaks without digits as first param

Open
#7,404 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI/RPC ▶
Dominant language
Python
Stars
8.6k
Forks
3.5k
Avg merge
2d 8h
Merged PRs (30d)
61

Description

$ electrum add_rrequest help

command will output:

Traceback (most recent call last):
  File "/usr/local/bin/electrum", line 472, in <module>
    main()
  File "/usr/local/bin/electrum", line 311, in main
    args = parser.parse_args()
  File "/usr/lib/python3.7/argparse.py", line 1758, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1790, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1999, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/usr/lib/python3.7/argparse.py", line 1955, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python3.7/argparse.py", line 1864, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/local/lib/python3.7/dist-packages/electrum/commands.py", line 1392, in subparser_call
    namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1790, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1999, in _parse_known_args
    stop_index = consume_positionals(start_index)
  File "/usr/lib/python3.7/argparse.py", line 1955, in consume_positionals
    take_action(action, args)
  File "/usr/lib/python3.7/argparse.py", line 1848, in take_action
    argument_values = self._get_values(action, argument_strings)
  File "/usr/lib/python3.7/argparse.py", line 2378, in _get_values
    value = self._get_value(action, arg_string)
  File "/usr/lib/python3.7/argparse.py", line 2411, in _get_value
    result = type_func(arg_string)
  File "/usr/local/lib/python3.7/dist-packages/electrum/commands.py", line 1325, in <lambda>
    'amount': lambda x: str(Decimal(x)) if x != '!' else '!',
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported electrum add_rrequest help failure, then inspect the argument parsing code in electrum/commands.py around the amount conversion shown in the traceback. Check how invalid positional input is handled elsewhere in the CLI. Done means this input produces a user-facing command error rather than an unhandled traceback.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.