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

struct.error: 'l' format requires -2147483648 <= number <= 2147483647 with samsung's device photo : exif tag 37379 #147

Open
ysimonx opened this issue Sep 25, 2024 · 0 comments

Comments

@ysimonx
Copy link

ysimonx commented Sep 25, 2024

Hello

I am using piexif

I have this error with following data

exif_data = {'0th': {271: b'samsung', 272: b'SM-S916B', 274: 6, 282: (72, 1), 283: (72, 1), 296: 2, 305: b'S916BXXU1AWA6', 306: b'2024:09:25 09:12:22', 531: 1, 34665: 202}, 'Exif': {33434: (1, 16), 33437: (180, 100), 34850: 2, 34855: 865, 36864: b'0220', 36867: b'2024:09:25 09:12:22', 36868: b'2024:09:25 09:12:22', 37121: b'\x01\x02\x03\x00', 37377: (1, 16), 37378: (169, 100), 37379: (4294966933, 100), 37380: (0, 100), 37381: (180, 100), 37383: 2, 37385: 2, 37386: (540, 100), 37520: b'979', 37521: b'979', 37522: b'979', 40961: 1, 41987: 0, 41989: 23, 41990: 0, 42016: b'P12XLPE00CM P12XLPE00CM'}, 'GPS': {0: (2, 0, 0, 0), 2: ((48, 1), (42, 1), (1091, 56)), 1: 'N', 4: ((2, 1), (52, 1), (3157, 86)), 3: 'E'}, 'Interop': {}, '1st': {}, 'thumbnail': None}
exif_bytes = piexif.dump(exif_data)

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/ysimonx/Developpement/api_renovadmin/env/lib/python3.11/site-packages/piexif/_dump.py", line 68, in dump
    exif_set = _dict_to_bytes(exif_ifd, "Exif", zeroth_length)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ysimonx/Developpement/api_renovadmin/env/lib/python3.11/site-packages/piexif/_dump.py", line 335, in _dict_to_bytes
    length_str, value_str, four_bytes_over = _value_to_bytes(raw_value,
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ysimonx/Developpement/api_renovadmin/env/lib/python3.11/site-packages/piexif/_dump.py", line 252, in _value_to_bytes
    new_value = struct.pack(">l", num) + struct.pack(">l", den)
                ^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'l' format requires -2147483648 <= number <= 2147483647

I found this is because
this : 37379: (4294966734, 100)

@ysimonx ysimonx changed the title lots of errors with samsung's device photo struct.error: 'l' format requires -2147483648 <= number <= 2147483647 with samsung's device photo Sep 25, 2024
@ysimonx ysimonx changed the title struct.error: 'l' format requires -2147483648 <= number <= 2147483647 with samsung's device photo struct.error: 'l' format requires -2147483648 <= number <= 2147483647 with samsung's device photo : exif tag 37379 Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant