Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search results' keys are just names, but sometimes in sub-folders #33

Closed
TheLastGimbus opened this issue Aug 6, 2022 · 4 comments · Fixed by #35
Closed

Search results' keys are just names, but sometimes in sub-folders #33

TheLastGimbus opened this issue Aug 6, 2022 · 4 comments · Fixed by #35
Assignees
Labels
bug : critical A bug was found in difPy, and it is critical to the functioning of the package.

Comments

@TheLastGimbus
Copy link

Hi there!
I have a folder like this:

folder/
| - IMG_202201.jpg
| - IMG_202202.jpg
| - subfolder/
|  | - IMG_202203.jpg

and i use it as first arg

i noticed that difPy.dif() search results give me just the file name... without the subfolder anyhow noted 😐

this broke my script with FileNotFoundError: [Errno 2] No such file or directory

@elisemercury
Copy link
Owner

elisemercury commented Aug 15, 2022

Hi @TheLastGimbus,
Thanks a lot for your feedback!
The keys of the results dictionary represent only the filenames of the images, and do not reflect their path/location. If you want to extract a file's location from the dictionary, I would suggest to extract it from the location key in the nested dictionary.

As an example:

for file in search.result.keys():
    print(f'{file} - {search.result[file]["location"]}')

I hope this is helpful! Let me know if you need any further help.
All the best,
Elise

@elisemercury elisemercury added the question Further information is requested. label Aug 15, 2022
@TheLastGimbus
Copy link
Author

Then what if i had

folder/
| - same_file1.jpg
| - same_file2.jpg
| - subfolder/
|  | - same_file1.jpg

Will the keys will be the same... ? This would be bad...

@elisemercury elisemercury reopened this Aug 15, 2022
@elisemercury
Copy link
Owner

elisemercury commented Aug 15, 2022

Hi again @TheLastGimbus,

Indeed, you are right, this would definitely be a scenario we want to avoid.

If I am not mistaken, as of today, if both samples of samefile1.jpg would both have duplicates within the image data, then these would be grouped under the same key in the results dictionary, and the filepath of the same_file1.jpg in the subfolder would be listed in the duplicates of the first samefile1.jpg.

I agree, this is not appropriate and expected behavior, since both samefile1.jpg samples might not necessarily be duplicates.

Thanks a lot for bringing up this issue! I will do some more testing around it, and if the scenario above is indeed the case, I will ASAP bring out a fix with the next release of difPy - I'll keep you posted.

Again, thanks a lot for your input! The more users use difPy, the more issues can be detected and the better the algorithm gets over time.

All the best,
Elise

@elisemercury elisemercury added bug : critical A bug was found in difPy, and it is critical to the functioning of the package. and removed question Further information is requested. labels Aug 15, 2022
@elisemercury elisemercury self-assigned this Aug 15, 2022
@elisemercury
Copy link
Owner

elisemercury commented Aug 21, 2022

Hi @TheLastGimbus,
This issue has now been resolved in release v2.4.2. The .result dictionary now contains keys with unique identifiers, and the image filename can now be extracted from the nested dictionary. You can refer to the difPy Usage Documentation for a detailed guide.
Again, thanks a lot for your input and all the best,
Elise

@elisemercury elisemercury linked a pull request Aug 21, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug : critical A bug was found in difPy, and it is critical to the functioning of the package.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants