Skip to content

Path("").exists() always returns True, which is a bug #112484

Closed as not planned
Closed as not planned
@yingshaoxo

Description

@yingshaoxo

Bug report

Bug description:

from pathlib import Path
print(Path("").exists())

import os
print(os.path.exists(""))

For empty string "", pathlib returns True, but os returns False.

Clearly, os is right, because you can't read anything from "".

CPython versions tested on:

3.10

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtopic-pathlibtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions