Skip to content

dev_tools/modules.py fails with a confusing error if invoked without argument #5702

@mhucka

Description

@mhucka

Description of the issue

The program dev_tools/modules.py exits with a confusing and user-unfriendly error message if it is invoked without any arguments. At the same time, it is not obvious (or at least, I haven't found it mentioned in the docs) that not passing any arguments to it is unsupported.

How to reproduce the issue

In a shell, with the current directory being the top level of the Cirq source code repo cloned from GitHub, run the following command:

python dev_tools/modules.py
Traceback (most recent call last):
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 317, in <module>
    main(sys.argv[1:])  # coverage: ignore
  File "/Users/mhucka/project-files/quantum/repos/Cirq/dev_tools/modules.py", line 309, in main
    f = args.func
AttributeError: 'Namespace' object has no attribute 'func'

Cirq version

0.16.0.dev

Additional comments

A user coming to Cirq might reasonably try to run python dev_tools/modules.py, not knowing ahead of time what arguments are valid. IMHO, it would be more user-friendly if modules.py would at least print a help message if invoked without arguments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug-reportSomething doesn't seem to work.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions