Sorry I didn't chime in sooner, as I'm pretty sure i know exactly what
the problem is, and I should have reported it a couple weeks ago when I
> Matplotlib aside, you might want to make sure you installed the
> Unicode version of wxWidgets, and reinstall it if necessary.
Actually, this is backwards -- I think the OP is using the unicode
version of wxPython, and that's the source of the problem. The unicode
version returns a unicode object from a FileDialog for a path. MPL can't
deal with a unicode filename, and thus the error:
>>>> Matplotlib backend_wx error
>>>> cannot return std::string from Unicode object
There are a couple solutions:
1) use the ansi, rather than unicode version of wxPython.
2) Patch MPL:
a) convert the filename to a string before passing it off to MPL --
this is an bad kludge, as the Mac (and recent Windows, and Linux,
and...) filesystem is unicode, and folks could have non-ansi characters
in their filenames.
b) Open the file with Python, and pass that into the MPL savefig
method, instead of the filename. This is apparently slow with older
MPLs, but has been fixed for good performance in SVN.
However, I think I tried this on the Mac, and it worked great, but on
Windows, I didn't get errors, but didn't get valid PNGs either. I ended
up going back to converting my filename to a string and passing that off
For more discussion.
Can an MPL dev fix this, please?
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception