Skip to content

Feature request: accept PathLike object as I/O filename #612

Closed
@fepegar

Description

@fepegar

I have recently started using Python 3's built-in pathlib module (introduced in PEP 428 for path managing in my projects and I really like it.

I thought that it would be nice if nibabel accepted PathLike objects as filenames, instead of only str or whatever the current behaviour is.

In my code I use wrappers for nib.load and nib.save that always transform the filename argument to str. That might be naive, but it seems to work. As a reference, matplotlib uses os.fspath if the filename argument is PathLike.

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