Skip to content

python 3.14 The class "FileType" is deprecated #35

@andytrawick

Description

@andytrawick

I recently started using fitdecode. Thank you for a great package.

I noticed the following messages when using both fittxt.py and fitjson.py. They work as expected under 3.14.

def parse_args(args=None):
...
      parser.add_argument(
              'infile', metavar='FITFILE', type=argparse.FileType(mode='rb'),
              help='Input .FIT file (use - for stdin)')

The class "FileType" is deprecated
Deprecated since Python 3.14. Open files after parsing arguments instead.

No indication as to when this will be removed.

The notice of this deprecation is in the 3.14 What's new document under the Deprecated/New deprecations headings.

Deprecated the argparse.FileType type converter. Anything relating to resource management should be handled downstream, after the arguments have been parsed. (Contributed by Serhiy Storchaka in gh-58032.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions