Skip to content

mimetypes CLI cannot handle multiple file parameters #136507

Description

@Wulian233

Bug report

Bug description:

According to

parser.add_argument('type', nargs='+', help='a type to search')

, the use of nargs='+' indicates that the original intention was to support passing multiple files and identifying their MIME types one by one

However, the current behavior only processes the first file. For example, running the following command:

> python mimetypes.py 1.pdf 1.png
type: application/pdf encoding: None

only outputs the type information for 1.pdf, while 1.png is ignored.

CPython versions tested on:

3.14

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions