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

Why is an exception raised at the end of rectangle method? #427

Closed
shakram02 opened this issue Jul 26, 2019 · 5 comments
Closed

Why is an exception raised at the end of rectangle method? #427

shakram02 opened this issue Jul 26, 2019 · 5 comments
Labels
Milestone

Comments

@shakram02
Copy link

@shakram02 shakram02 commented Jul 26, 2019

Hello, thank you for your amazing work,

I was wondering why rectangle raises an exception here

The reason behind my question is that when I clone the Drawing object then try to draw a rectangle it throws an exception, if I don't clone the Drawing object the function works normally.

  File "/home/ahmed/.local/lib/python3.7/site-packages/wand/drawing.py", line 1826, in rectangle
    self.raise_exception()
  File "/home/ahmed/.local/lib/python3.7/site-packages/wand/resource.py", line 236, in raise_exception
    e = self.get_exception()
  File "/home/ahmed/.local/lib/python3.7/site-packages/wand/resource.py", line 229, in get_exception
    message = desc.value
AttributeError: 'bytes' object has no attribute 'value'

I have the latest version: wand-0.5.5

Thanks ✌️

@shakram02 shakram02 closed this Jul 26, 2019
@shakram02 shakram02 reopened this Jul 26, 2019
@emcconville
Copy link
Owner

@emcconville emcconville commented Jul 26, 2019

Can you post an example of the Drawing clone?

Loading

@shakram02
Copy link
Author

@shakram02 shakram02 commented Jul 26, 2019

Sure, I'll try to extract an isolated code and then update the issue

Loading

@emcconville
Copy link
Owner

@emcconville emcconville commented Jul 26, 2019

Ah. I think I see this issue. Not related to rectangle method. There is an exception that's outstanding from a previous action. I doubt you would be able to isolated the code without seeing the previous exception message. Perhaps cloning was the smallest of things that allowed the issue to be identified.

Problem has been fixed on master branch, and should be apart of the 0.5.6 release -- due out in a couple of weeks.

Loading

@emcconville emcconville added this to the Wand 0.5.6 milestone Jul 26, 2019
@shakram02
Copy link
Author

@shakram02 shakram02 commented Jul 28, 2019

thanks

Loading

@shakram02
Copy link
Author

@shakram02 shakram02 commented Jan 11, 2020

Hey Eric, the exception was raised again after updating python, I guess the library also got an update(s).

It was raised here. The thing is, commenting the self.raise_exception() line makes everything work as usual.

I'm drawing a flipped (right<> left) rectangle tbh, so maybe that's why it reports a negative size.

I'm doing this though because I'm using an RTL language and putting the rectangle bounds in the expected manner makes the drawn rectangle render on the opposite side with the text I'm highlighting. Hopefully this gives some insight.

Here's the relevant stack trace.

    ctx.rectangle(int(r_right + right_delta), r_top,
  File "[...]/.venv/python/lib/python3.8/site-packages/wand/drawing.py", line 1826, in rectangle
    self.raise_exception()
  File "[...]/.venv/python/lib/python3.8/site-packages/wand/resource.py", line 240, in raise_exception
    raise e
wand.exceptions.CorruptImageError: negative or zero image size `' @ error/image.c/CloneImage/819

Loading

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

Successfully merging a pull request may close this issue.

None yet
2 participants