Winerror 3 for text extraction

How can I fix this?

File "C:\Users\steve\Desktop\my_code.py", line 15, in extract_text_from_images
    image_files = [os.path.join(folder_path, file) for file in os.listdir(folder_path) if file.endswith((".png", ".jpg", ".jpeg"))]
                                                               ^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Steve\\Desktop\\Imagesfortextextraction'

I tried fixing the error by naming the folder where the images are supposed to be stored, but no luck.

  • As the error is indicating, os.listdir can’t seem to find folder_path which has value "C:\\Users\\Steve\\Desktop\\Imagesfortextextraction". Try replacing folder_path with a hardcoded absolute path to the expected folder.

    – 

  • can you please explain how should i change the folder path?i am new to coding

    – 




Leave a Comment