Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrapy parse -h throws error #5481

Closed
alexpdev opened this issue Apr 17, 2022 · 6 comments · Fixed by #5482
Closed

scrapy parse -h throws error #5481

alexpdev opened this issue Apr 17, 2022 · 6 comments · Fixed by #5482
Milestone

Comments

@alexpdev
Copy link
Contributor

Description

running scrapy parse -h from inside of a project throws an error.

Steps to Reproduce

  1. scrapy startproject example
  2. cd example
  3. scrapy parse -h

Expected behavior: It should show the help message output for the parse command
Actual behavior: Throws error and displays traceback information
Reproduces how often: Every time I tried it.

Versions

v2.6.1

Additional context

I identified the issue and will submit a PR shortly.

alexpdev added a commit to alexpdev/scrapy that referenced this issue Apr 17, 2022
@elacuesta
Copy link
Member

I can reproduce. For completeness, here's the full output I'm getting:

$ scrapy parse -h
Traceback (most recent call last):
  File "/home/eugenio/zyte/scrapy/venv-scrapy/bin/scrapy", line 33, in <module>
    sys.exit(load_entry_point('Scrapy', 'console_scripts', 'scrapy')())
  File "/home/eugenio/zyte/scrapy/scrapy/cmdline.py", line 141, in execute
    opts, args = parser.parse_known_args(args=argv[1:])
  File "/usr/local/lib/python3.9/argparse.py", line 1851, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/local/lib/python3.9/argparse.py", line 2060, in _parse_known_args
    start_index = consume_optional(start_index)
  File "/usr/local/lib/python3.9/argparse.py", line 2000, in consume_optional
    take_action(action, args, option_string)
  File "/usr/local/lib/python3.9/argparse.py", line 1928, in take_action
    action(self, namespace, argument_values, option_string)
  File "/usr/local/lib/python3.9/argparse.py", line 1092, in __call__
    parser.print_help()
  File "/usr/local/lib/python3.9/argparse.py", line 2548, in print_help
    self._print_message(self.format_help(), file)
  File "/usr/local/lib/python3.9/argparse.py", line 2532, in format_help
    return formatter.format_help()
  File "/usr/local/lib/python3.9/argparse.py", line 283, in format_help
    help = self._root_section.format_help()
  File "/usr/local/lib/python3.9/argparse.py", line 214, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/local/lib/python3.9/argparse.py", line 214, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/local/lib/python3.9/argparse.py", line 214, in format_help
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/local/lib/python3.9/argparse.py", line 214, in <listcomp>
    item_help = join([func(*args) for func, args in self.items])
  File "/usr/local/lib/python3.9/argparse.py", line 530, in _format_action
    help_text = self._expand_help(action)
  File "/usr/local/lib/python3.9/argparse.py", line 626, in _expand_help
    return self._get_help_string(action) % params
TypeError: %d format: a number is required, not dict

I suspect this was valid with optparse and broke on the move to argparse (#5374)

@Gallaecio Gallaecio added this to the 2.6.2 milestone Apr 18, 2022
alexpdev added a commit to alexpdev/scrapy that referenced this issue Apr 24, 2022
alexpdev added a commit to alexpdev/scrapy that referenced this issue Apr 24, 2022
@Urahara
Copy link

Urahara commented Apr 29, 2022

@wRAR @Gallaecio Can we close this issue since is fixed on 2.6?

@wRAR
Copy link
Member

wRAR commented Apr 29, 2022

It's not fixed in master and I'm not sure what is our policy for this.

@alexpdev
Copy link
Contributor Author

alexpdev commented May 6, 2022

Hello, should I close this issue?

@Gallaecio
Copy link
Member

Not yet. We will close it once we port the change from the 2.6 branch to the main branch.

@Gallaecio
Copy link
Member

Actually, since we merge 2.6.2 into the main branch as part of the release process, there is no reason to keep this open.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants