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

repr(Image()) raises an Error #265

roelandschoukens opened this issue Nov 29, 2015 · 2 comments

repr(Image()) raises an Error #265

roelandschoukens opened this issue Nov 29, 2015 · 2 comments


Copy link

@roelandschoukens roelandschoukens commented Nov 29, 2015

calling repr(Image()) will raise an error:

>>> from wand.image import Image
>>> i = Image()
>>> print(i.wand)
>>> print(i.signature)
>>> repr(i)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\roeland\Documents\dev\wand\wand\", line 3162, in __repr__
    self.signature[:7], self.format, self.width, self.height
TypeError: 'NoneType' object is not subscriptable
Copy link

@emcconville emcconville commented Nov 30, 2015

It's true that this use-case should be handled better. The __repr__ method should expect null structures.

with Image() as i:
  print(i.wand)  # Should give wand structure pointer. =>  '0xbf07e076c0'
  print(i.signature)  # No authenticated/cache pixels, so 'None' is expected.
  repr(i)  # Empty MagicWand structure. => '???'
repr(i)  # Deallocated structure. => '<wand.image.Image: (closed)>'

So I should ask. What should repr string be for the allocated, but uninitialized wand instant?

Perhaps <wand.image.Image: (empty)>, or <wand.image.Image: (alloc)>?

Copy link

@dahlia dahlia commented Dec 1, 2015

<wand.image.Image: (empty)> seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants