error in savefig with wxAgg backend

Hello,

I’m trying to use savefig in my wx app and I’m
using wxAgg backend. I’m getting this error:

FILE …maplotlib\backends\backend_bases.py, line 397 in
print_png

Self.get_renderer()._renderer.write_png(filename,
self.figure.dpi.dpi.get())

TypeError: cannot return std::string from Unicode object

I’m simply calling this:

self.figure.savefig(image_file,

                        facecolor='w',

                        edgecolor='w')

How do I fix this problem? Thanks.

Jeff

What version of matplotlib are you using? I have a vague recollection that this was fixed at one point.

In any case, you should be able to get around this by casting your filename to a string as such:

self.figure.savefig(str(image_file))

Hope that works for you,
Mike

Jeff Peery wrote:

···

Hello,

I�m trying to use savefig in my wx app and I�m using wxAgg backend. I�m getting this error:

FILE �maplotlib\backends\backend_bases.py, line 397 in print_png

Self.get_renderer()._renderer.write_png(filename, self.figure.dpi.dpi.get())

TypeError: cannot return std::string from Unicode object

I�m simply calling this:

self.figure.savefig(image_file,

                            facecolor='w',

                            edgecolor='w')

How do I fix this problem? Thanks.

Jeff

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Hi Mike, thanks for the tip. I will try it. I'm using 0.91.2.

Thanks,
Jeff

···

-----Original Message-----
From: Michael Droettboom [mailto:mdroe@…86…]
Sent: Monday, March 03, 2008 5:06 AM
To: JeffPeery@…420…
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] error in savefig with wxAgg backend

What version of matplotlib are you using? I have a vague recollection
that this was fixed at one point.

In any case, you should be able to get around this by casting your
filename to a string as such:

self.figure.savefig(str(image_file))

Hope that works for you,
Mike

Jeff Peery wrote:

Hello,

I'm trying to use savefig in my wx app and I'm using wxAgg backend. I'm
getting this error:

FILE .maplotlib\backends\backend_bases.py, line 397 in print_png

Self.get_renderer()._renderer.write_png(filename,

self.figure.dpi.dpi.get())

TypeError: cannot return std::string from Unicode object

I'm simply calling this:

self.figure.savefig(image_file,

                            facecolor='w',

                            edgecolor='w')

How do I fix this problem? Thanks.

Jeff

------------------------------------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA