Skip to content

Use of undocumented ArgumentParser method breaking compatibility with newer Python versions #21

@matt-graham

Description

@matt-graham

After installing the package in a Conda environment with Python 3.12 and attempting to run

swot_simulator --template conf.py

a TypeError is raised with traceback

Traceback (most recent call last):
  File "envs/swot_simulator/bin/swot_simulator", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "envs/swot_simulator/lib/python3.12/site-packages/swot_simulator/launcher.py", line 459, in main
    args = usage()
           ^^^^^^^
  File "envs/swot_simulator/lib/python3.12/site-packages/swot_simulator/launcher.py", line 120, in usage
    namespace, _ = parser._parse_known_args(sys.argv[1:], namespace)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ArgumentParser._parse_known_args() missing 1 required positional argument: 'intermixed'

This appears to be due to the call to the undocumented ArgumentParser._parse_known_args method in

namespace, _ = parser._parse_known_args(sys.argv[1:], namespace)

for which the interface has presumably change between the Python version the package was developed with and Python 3.12.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions