Python Forum
p]Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
p]Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same
#1
Why os.path.exists("abc/d") and os.path.exists("abc/D") treat same but actually both are different path. Before running create abc folder and then inside abc folder create d folder to test it.
print(os.path.exists("abc/d")==os.path.exists("abc/D"))
Output it gives is true and it should be false.
Reply
#2
I guess you're on a Windows-System where the file-system is not case-sensitive.
If you want to have False as result, you've to switch to Linux, Mac or some other *bsd like system.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Appending sys.path not working with spyder Larz60+ 2 491 Apr-11-2025, 08:50 AM
Last Post: Larz60+
  How does venv update $PATH without activating on Windows? bottomfeeder 3 747 Mar-13-2025, 01:46 PM
Last Post: DeaD_EyE
  Get an FFMpeg pass to subprocess.PIPE to treat list as text file? haihal 2 1,045 Nov-21-2024, 11:48 PM
Last Post: haihal
  Path must be screwed up somewhere BR549py 4 2,163 Sep-09-2024, 04:58 PM
Last Post: deanhystad
  os.path.exists fails with accented characters glenndrives 11 2,813 Sep-03-2024, 05:30 PM
Last Post: glenndrives
  Dictionary using path. Bobbee 5 1,052 Aug-22-2024, 08:43 PM
Last Post: Bobbee
  FileNotFoundError: [Errno 2] No such file or directory although the file exists Arnibandyo 0 958 Aug-12-2024, 09:11 AM
Last Post: Arnibandyo
  import a function from another file using relative path paul18fr 6 3,016 Aug-01-2024, 06:40 AM
Last Post: paul18fr
  Pandas ExcelWriter path name rejected morningglory 0 739 Jul-15-2024, 06:36 PM
Last Post: morningglory
  Using OpenCV and image path is invalid AudunNilsen 5 1,969 Mar-18-2024, 05:28 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020