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

Error: int too big to convert #176

Open
Nzara opened this issue Mar 5, 2023 · 0 comments
Open

Error: int too big to convert #176

Nzara opened this issue Mar 5, 2023 · 0 comments

Comments

@Nzara
Copy link

Nzara commented Mar 5, 2023

I used the code below to add the non-existing gps_img_direction and got a stacktace. The image concerned is attached.

from exif import Image
image = Image("i.jpg")
image.set('gps_img_direction', 0)
Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\exif\_app1_metadata.py", line 611, in __setattr__
    ifd_tag = self.ifd_tags[attribute_id]
KeyError: 17

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\plum\transform.py", line 72, in pack
    self.__pack__(value, pieces, None)
  File "C:\Python311\Lib\site-packages\plum\int.py", line 174, in __pack__
    pieces.append(value.to_bytes(nbytes, byteorder, signed=signed))
OverflowError: int too big to convert

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python311\Lib\site-packages\plum\transform.py", line 90, in pack_and_dump
    self.__pack__(value, pieces, dump.add_record(fmt=self.__format_name__))
  File "C:\Python311\Lib\site-packages\plum\int.py", line 180, in __pack__
    piece = value.to_bytes(nbytes, byteorder, signed=signed)
OverflowError: int too big to convert

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    image.set('gps_img_direction', 0)
  File "C:\Python311\Lib\site-packages\exif\_image.py", line 254, in set
    setattr(self, attribute, value)
  File "C:\Python311\Lib\site-packages\exif\_image.py", line 116, in __setattr__
    setattr(self._segments["APP1"], key.lower(), value)
  File "C:\Python311\Lib\site-packages\exif\_app1_metadata.py", line 614, in __setattr__
    self._add_tag(key, value)
  File "C:\Python311\Lib\site-packages\exif\_app1_metadata.py", line 381, in _add_tag
    app1_len += added_bytes
  File "C:\Python311\Lib\site-packages\plum\view.py", line 218, in __iadd__
    self.set(self.unpack() + other)
  File "C:\Python311\Lib\site-packages\plum\view.py", line 187, in set
    membytes = fob.pack(value)
  File "C:\Python311\Lib\site-packages\plum\transform.py", line 75, in pack
    self.pack_and_dump(value)
  File "C:\Python311\Lib\site-packages\plum\transform.py", line 92, in pack_and_dump
    raise exceptions.PackError(dump=dump, exception=exc) from exc
plum.exceptions.PackError: 

+--------+-------+-------+--------+
| Offset | Value | Bytes | Format |
+--------+-------+-------+--------+
|        | 65555 |       | uint16 |
+--------+-------+-------+--------+

OverflowError occurred during pack operation:

int too big to convert

i

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