Skip to content

Path(file_path).exists does not work on windows 10 #1519

@santhoshnumberone

Description

@santhoshnumberone

Bug
Path(file_path).exists return True even if the file doesn't exist

To Reproduce
Steps to reproduce the behavior:

  1. install python on Windows 10
  2. Open python in 'cmd'
  3. Import the library pathlib

from pathlib import Path

  1. Give any random file check if it exists

bool(Path("C:\User1").exists)
True

Expected behavior

bool(Path("C:\User1").exists)
False

Works fine if os used instead of pathlib

import os
os.path.exists("C:\User1")
False

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Wndows 10
  • Browser any
  • Version Microsoft Windows [Version 10.0.18362.356]

Bug reported Issue35692

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugThis is not a bug, but someone thought it was

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions