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

Bug instantiating gimp file with GimpDocument. Seems like its an issue with changes to str and bytes. #2

Closed
ismaelharunid opened this issue Apr 2, 2021 · 2 comments

Comments

@ismaelharunid
Copy link

from gimpformats.gimpXcfDocument import GimpDocument
imagepath = 'borders.xcf'
doc = GimpDocument(imagepath)

Produces the follow dump:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/gimpXcfDocument.py", line 65, in __init__
    self.load(fileName)
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/gimpXcfDocument.py", line 82, in load
    self.decode(data)
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/gimpXcfDocument.py", line 121, in decode
    self._propertiesDecode(ioBuf)
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/GimpIOBase.py", line 703, in _propertiesDecode
    self._propertyDecode(propertyType, ioBuf.getBytes(dataLength))
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/GimpIOBase.py", line 441, in _propertyDecode
    self._guidelinesDecode(data)
  File "/home/ismael/miniconda3/lib/python3.7/site-packages/gimpformats/GimpIOBase.py", line 286, in _guidelinesDecode
    isVertical = struct.unpack(">B", data[index])[0] == 2
TypeError: a bytes-like object is required, not 'int'

It looks like it's likely caused by changes to bytes and str and between old and newer version of python. I'll update this "issue" as I get more detailed information. In the meantime, I'm sure you must already know or is this possibly a dead project?

@FredHappyface
Copy link
Member

If you wanna make a pull request that'd be very much appreciated. Also it might be worth taking a look at #1 as this is where my thoughts are regarding the future of the project

@FredHappyface
Copy link
Member

Think I've fixed it

If this is still broken then can you send me the xcf file and I'll take another look sometime

Thanks

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

2 participants