theovercomer8 / captionr

GIT/BLIP/CLIP Caption tool
MIT License
139 stars 14 forks source link

Error with Posix Path with --output #13

Closed mediocreatmybest closed 1 year ago

mediocreatmybest commented 1 year ago

Using the --output folder generates a path error in Linux. (Not sure if this is the same in Windows?)

Traceback (most recent call last):
  File "/home/machinelearning/tools/captionr/captionr/captionr_class.py", line 261, in process_img
    with open(outputfilename, "w", encoding="utf8") as file:
FileNotFoundError: [Errno 2] No such file or directory: "[PosixPath('/home/machinelearning/datasets/processing/output_folder')]/image_123456.txt"

I got it working by changing the line.

                  else:
                        if isinstance(config.output, pathlib.PosixPath):
                            dirname = str(config.output)

Not sure if that is a good fix though?

theovercomer8 commented 1 year ago

Are you still experiencing this?

mediocreatmybest commented 1 year ago

Yep, same issue with --output in Linux (not sure if this is an issue in Windows)

INFO:root:Loading Git Model...
  0%|| 0/3 [00:00<?, ?it/s]ERROR:root:Exception occurred processing /home/machinelearning/datasets/test/Face1.png
Traceback (most recent call last):
  File "/home/machinelearning/tools/captionr/captionr/captionr_class.py", line 268, in process_img
    with open(outputfilename, "w", encoding="utf8") as file:
FileNotFoundError: [Errno 2] No such file or directory: "[PosixPath('/home/machinelearning/datasets/output')]/Face1.txt"
 33%|████████████████████████████████████████████████▎                                                                                                | 1/3 [00:03<00:06,  3.18s/it]
mediocreatmybest commented 1 year ago

Stale issue. Closing.