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

WebAgg: _png.write_png raises TypeError #3763

Merged
merged 1 commit into from Nov 7, 2014

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Nov 7, 2014

This looks like a regression after 1.4.x.
Trying to view the plots results in

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tornado/websocket.py", line 303, in wrapper
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg.py", line 229, in on_message
    manager.handle_json(message)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 361, in handle_json
    self.canvas.handle_event(content)
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 192, in handle_event
    self.draw()
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 90, in draw
    self.manager.refresh_all()
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 365, in refresh_all
    diff = self.canvas.get_diff_image()
  File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 147, in get_diff_image
    self._png_buffer)
TypeError: Cannot cast array data from dtype('uint32') to dtype('uint8') according to the rule 'safe'

looks like this happened after write_png() API changed.

@WeatherGod
Copy link
Member

Which version of numpy are you using? Also, is this independent of any
plotting command (i.e., it doesn't matter if it is imshow() or plot(), etc?)

On Fri, Nov 7, 2014 at 9:45 AM, Vadim Markovtsev notifications@github.com
wrote:

This looks like a regression after 1.4.x.
Trying to view the plots results in

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/tornado/websocket.py", line 303, in wrapper
return callback(_args, *_kwargs)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg.py", line 229, in on_message
manager.handle_json(message)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 361, in handle_json
self.canvas.handle_event(content)
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 192, in handle_event
self.draw()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 90, in draw
self.manager.refresh_all()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 365, in refresh_all
diff = self.canvas.get_diff_image()
File "/usr/lib/python3/dist-packages/matplotlib/backends/backend_webagg_core.py", line 147, in get_diff_image
self._png_buffer)TypeError: Cannot cast array data from dtype('uint32') to dtype('uint8') according to the rule 'safe'

looks like this happened after write_png() API change.


Reply to this email directly or view it on GitHub
#3763.

@tacaswell tacaswell added this to the v1.5.x milestone Nov 7, 2014
@mdboom mdboom self-assigned this Nov 7, 2014
@mdboom
Copy link
Member

mdboom commented Nov 7, 2014

Fix attached.

@tacaswell
Copy link
Member

@vmarkovtsev I'll merge this when you confirm that it fixes the problem.

Exactly which commit are you working off of? Trying to sort out if this needs to be back-ported to the 1.4.x branch, or just on master.

@mdboom
Copy link
Member

mdboom commented Nov 7, 2014

My guess is just master -- as I think this has to do with the C++ refactor. But @vmarkovtsev should confirm in case there is another bug lurking on 1.4.x.

@vmarkovtsev
Copy link
Contributor Author

I confirm that there is no issue with 1.4.x. I am using matplotlib daily builds ppa for Ubuntu and apart from upgrading it, nothing changes, e.g. numpy (1.8.2).

tacaswell added a commit that referenced this pull request Nov 7, 2014
BUG : fix type being passed to png writer in webAgg
@tacaswell tacaswell merged commit cf4f332 into matplotlib:master Nov 7, 2014
@mdboom mdboom deleted the fix-webagg branch March 3, 2015 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants