problem with a umlaut

I have a weird problem with Unicode strings. I am using windows 7 with
Python 2.7.2 64 bit, and matplotlib 1.2.1 (package from Unofficial Windows
Binaries at http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib ).

When i run:
    -*- coding: utf-8 -*-
    import matplotlib.pyplot as plt

    fig = plt.figure( )

    ax = fig.add_subplot(111)
    ax.hist([1,2,3,4,5,6,7,8,9,10], bins=range(1,11) )

    plt.ylabel(u'ä')
    fig.savefig('test.eps')

I get a crash:

pythonw -u "bugtest.py"
Exit code: -1073740777

but if i modify my code to read:
    -*- coding: utf-8 -*-
    import matplotlib.pyplot as plt

    fig = plt.figure( )

    ax = fig.add_subplot(111)
    ax.hist([1,2,3,4,5,6,7,8,9,10], bins=range(1,11) )

    plt.ylabel(u'äł')
    fig.savefig('test.eps')

Then no longer crashes. Why is it that "a umlaut" alone crashes
but when the string contains a "l stroke" character the Unicode string
behaves fine. In both cases it works fine if I show the plot but not when
I write eps either in code or when saving.

Which backend are you using? I can't reproduce. Does

https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py

work for you?

Mike

···

On 05/15/2013 06:40 AM, Ojala Janne wrote:

I have a weird problem with Unicode strings. I am using windows 7 with
Python 2.7.2 64 bit, and matplotlib 1.2.1 (package from Unofficial Windows
Binaries at http://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib ).

When i run:
     -*- coding: utf-8 -*-
     import matplotlib.pyplot as plt

     fig = plt.figure( )

     ax = fig.add_subplot(111)
     ax.hist([1,2,3,4,5,6,7,8,9,10], bins=range(1,11) )

     plt.ylabel(u'�')
     fig.savefig('test.eps')

I get a crash:

pythonw -u "bugtest.py"
Exit code: -1073740777

but if i modify my code to read:
     -*- coding: utf-8 -*-
     import matplotlib.pyplot as plt

     fig = plt.figure( )

     ax = fig.add_subplot(111)
     ax.hist([1,2,3,4,5,6,7,8,9,10], bins=range(1,11) )

     plt.ylabel(u'�')
     fig.savefig('test.eps')

Then no longer crashes. Why is it that "a umlaut" alone crashes
but when the string contains a "l stroke" character the Unicode string
behaves fine. In both cases it works fine if I show the plot but not when
I write eps either in code or when saving.

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Which backend are you using? I can't reproduce. Does

https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py

work for you?

The bug only happens if I try to save the figure as EPS. So I suppose that
then means its a cairo back end (happens also if I force cairo). So that means
as written the code works fine but if i try to make publishable quality output
by saving as EPS (a raster image is not suitable), it crashes.

But it again works if I add any character thats so weird that ist on a n extended
unicode block then all characters seem to be handled correctly. Even the ones
that previously crashed.

I can reproduce the crash on Python 2.7, 32 and 64 bit. Python 2.6 and 3.3 appear to work. The call stack is attached. The crash is in ttfont_add_glyph_dependencies() at <https://github.com/matplotlib/matplotlib/blob/v1.2.x/ttconv/pprdrv_tt2.cpp#L703>

Christoph

mpl_umlaut_callstack.txt (8.93 KB)

···

On 5/15/2013 1:55 PM, Ojala Janne wrote:

Which backend are you using? I can't reproduce. Does

https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py

<https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py>

work for you?

The bug only happens if I try to save the figure as EPS. So I suppose that
then means its a cairo back end (happens also if I force cairo). So that
means
as written the code works fine but if i try to make publishable quality
output
by saving as EPS (a raster image is not suitable), it crashes.

But it again works if I add any character thats so weird that ist on a n
extended
  unicode block then all characters seem to be handled correctly. Even
the ones
that previously crashed.

I've created an issue in the tracker for this:

https://github.com/matplotlib/matplotlib/issues/2016

Mike

···

On 05/15/2013 06:26 PM, Christoph Gohlke wrote:

On 5/15/2013 1:55 PM, Ojala Janne wrote:

Which backend are you using? I can't reproduce. Does

https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py

<https://github.com/matplotlib/matplotlib/blob/master/examples/text_labels_and_annotations/unicode_demo.py>

work for you?

The bug only happens if I try to save the figure as EPS. So I suppose that
then means its a cairo back end (happens also if I force cairo). So that
means
as written the code works fine but if i try to make publishable quality
output
by saving as EPS (a raster image is not suitable), it crashes.

But it again works if I add any character thats so weird that ist on a n
extended
  unicode block then all characters seem to be handled correctly. Even
the ones
that previously crashed.

I can reproduce the crash on Python 2.7, 32 and 64 bit. Python 2.6 and 3.3 appear to work. The call stack is attached. The crash is in ttfont_add_glyph_dependencies() at <https://github.com/matplotlib/matplotlib/blob/v1.2.x/ttconv/pprdrv_tt2.cpp#L703>

Christoph

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d

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