Skip to content

Bug Serialization of lower_quality.txt fails #110

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

Closed
AliSot2000 opened this issue Dec 18, 2024 · 2 comments · Fixed by #116
Closed

Bug Serialization of lower_quality.txt fails #110

AliSot2000 opened this issue Dec 18, 2024 · 2 comments · Fixed by #116
Labels
bug : non-critical A bug was found in difPy, but it is not critical to the functioning of the package. status : implemented Feature was implemented in difPy.

Comments

@AliSot2000
Copy link

Serializing the list of lower quality files fails. By the looks of it, instead of the paths, the np.ndarray objects are passed into the lower_quailty leading to a TypeError: Object of type ndarray is not JSON serializable

This is the full shell output:

(lv2) alisot2000@AliSot2000-Linux-ROG-Zephyrus-G14:~/Desktop/lv2/lib/python3.12/site-packages/difPy$ python3 dif.py -D /home/alisot2000/Desktop/test-dirs2/dir_a/ /home/alisot2000/Desktop/test-dirs2/dir_b/ /home/alisot2000/Desktop/test-dirs2/dir_c/ -Z /home/alisot2000/Desktop/test-dirs2/ -mv /home/alisot2000/Desktop/test-dirs2/output/ -s 66
Error DecompressionBombWarning loading image #14 : '/home/alisot2000/Desktop/test-dirs2/dir_a/Panorama 2.jpg' -> Image size (118755328 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack.
Error DecompressionBombWarning loading image #109 : '/home/alisot2000/Desktop/test-dirs2/dir_c/Panorama 2.jpg' -> Image size (118755328 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack.
difPy preparing files: [100%]
difPy searching files: [100%]
Moved 74 files(s) to "/home/alisot2000/Desktop/test-dirs2/output"
Traceback (most recent call last):
  File "/home/alisot2000/Desktop/lv2/lib/python3.12/site-packages/difPy/dif.py", line 1029, in <module>
    json.dump(se.lower_quality, file)
  File "/usr/lib/python3.12/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/usr/lib/python3.12/json/encoder.py", line 439, in _iterencode
    o = _default(o)
        ^^^^^^^^^^^
  File "/usr/lib/python3.12/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable
@elisemercury elisemercury added bug : non-critical A bug was found in difPy, but it is not critical to the functioning of the package. status : in progress Feature is currently being implemented in difPy. labels Dec 19, 2024
@elisemercury
Copy link
Owner

Hi @AliSot2000,

Thanks a lot for reporting this bug! This will definitely be considered for the upcoming update.

@elisemercury elisemercury added status : implemented Feature was implemented in difPy. and removed status : in progress Feature is currently being implemented in difPy. labels Jan 7, 2025
@elisemercury elisemercury linked a pull request Jan 7, 2025 that will close this issue
@elisemercury
Copy link
Owner

Hi @AliSot2000,

Thanks again for filing this issue! We have implemented a fix for this as part of version 4.2.0.

Thanks,
Elise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug : non-critical A bug was found in difPy, but it is not critical to the functioning of the package. status : implemented Feature was implemented in difPy.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants