OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Python - os.path.exists for jpg

  • Thread starter Thread starter Jeje Hombold
  • Start date Start date
J

Jeje Hombold

Guest
I tried to read jpg pictures, but the path was always not found even though the path was correct. So I checked with os.path.exists. The image is called "ralf". And for

Code:
os.path.exists("C:\Dokumente\ralf.jpg")

I got the return "false".

But when I renamed the image to "IMG-ralf" and tried:

Code:
os.path.exists("C:\Dokumente\IMG-ralf.jpg")

It could find the path and the return was "true".

Does anyone know why renaming the image made a difference?

Can I solve the problem differently? I have like 4000 images where the name is related to a specific label (saved in an excel file with name of the image and label), so I can not just rename all of them, because then I won't know the label anymore. Code
<p>I tried to read jpg pictures, but the path was always not found even though the path was correct. So I checked with <code>os.path.exists</code>. The image is called "ralf". And for</p>
<pre><code>os.path.exists("C:\Dokumente\ralf.jpg")
</code></pre>
<p>I got the return "false".</p>
<p>But when I renamed the image to "IMG-ralf" and tried:</p>
<pre><code>os.path.exists("C:\Dokumente\IMG-ralf.jpg")
</code></pre>
<p>It could find the path and the return was "true".</p>
<p>Does anyone know why renaming the image made a difference?</p>
<p>Can I solve the problem differently? I have like 4000 images where the name is related to a specific label (saved in an excel file with name of the image and label), so I can not just rename all of them, because then I won't know the label anymore.
<a href="https://i.sstatic.net/0kp0dIAC.png" rel="nofollow noreferrer">Code</a></p>
 

Latest posts

A
Replies
0
Views
1
Anthonin Chaboteaux
A
Top