random crash, Pango-WARNING

Hi

With 0.87 and 0.86.2 mpl randomly crashes when executing this script:

···

---------------------------
from pylab import *
from matplotlib import verbose

verbose.level = 'debug-annoying'
##verbose.level = 'debug'

rcParams['text.usetex'] = True
plot([1,2,3])

savefig("image.eps")
---------------------------

The crash is triggered when savefig() is called and only if rcParams['text.usetex'] = True. The error message is

  (test.py:7258): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

I tried to track it down but the crash seems to occur in *different* code segments (calling "python test.py" several times it crashed sometimes after a call to dvips, sometimes dvipng, gs, ...). Sometimes
it even *doesn't* crash at all.

I have the following pango-stuff installed (Debian):

elcorto@...662...:~$ COLUMNS=200 dpkg -l | grep pango
ii libpango1.0-0 1.8.1-1

ii libpango1.0-common 1.8.1-1

ii libpango1.0-dbg 1.8.1-1

ii libpango1.0-dev 1.8.1-1

Here's an example debug output:

----------------------------------------------------------------------------------------------------------
elcorto@...662...:~$ python test.py
FigureCanvasAgg.print_figure
FigureCanvasAgg.draw
RendererAgg.__init__
RendererAgg._get_agg_font
         findfont failed Lucida Grande
         findfont failed Verdana
         findfont failed Geneva
         findfont failed Lucida
         findfont found Bitstream Vera Sans, normal, normal 500, normal, 12.0
findfont returning /usr/lib/python2.3/site-packages/matplotlib/mpl-data/Vera.ttf
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
RendererAgg.points_to_pixels
RendererAgg._get_agg_font
matplotlib data path /usr/lib/python2.3/site-packages/matplotlib/mpl-data
latex -interaction=nonstopmode "/tmp/15f8552d172b5a41c557b4ad371e3782.tex"
This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5)
entering extended mode
(/tmp/15f8552d172b5a41c557b4ad371e3782.tex
LaTeX2e <2001/06/01>
Babel <v3.7h> and hyphenation patterns for american, french, german, ngerman, b
ahasa, basque, catalan, croatian, czech, danish, dutch, finnish, greek, iceland
ic, irish, italian, latin, magyar, norsk, norsk, portuges, romanian, russian, s
lovak, slovene, spanish, swedish, turkish, ukrainian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2003/01/31 v2.9n LaTeX2e KOMA document class
(/usr/share/texmf/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2003/01/31 v2.9n LaTeX2e KOMA package
                   Copyright (C) Markus Kohm

) (/usr/share/texmf/tex/latex/base/size11.clo)
(/usr/share/texmf/tex/latex/koma-script/typearea.sty
Package typearea, 2003/01/31 v2.9n LaTeX2e KOMA package
                   Copyright (C) Frank Neukam, 1992-1994
                   Copyright (C) Markus Kohm, 1994-2002

)) (/usr/share/texmf/tex/latex/misc/type1cm.sty)
(/usr/share/texmf/tex/latex/psnfss/helvet.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty))
(/usr/share/texmf/tex/latex/psnfss/courier.sty)
(/usr/share/texmf/tex/latex/base/textcomp.sty
(/usr/share/texmf/tex/latex/base/ts1enc.def))
(/usr/share/texmf/tex/latex/misc/psfrag.sty
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf/tex/latex/graphics/dvips.def)))
(/usr/share/texmf/tex/latex/graphics/graphicx.sty)
(/usr/share/texmf/tex/latex/graphics/color.sty
(/usr/share/texmf/tex/latex/config/color.cfg)
(/usr/share/texmf/tex/latex/graphics/dvipsnam.def))
(./15f8552d172b5a41c557b4ad371e3782.aux)
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf/tex/latex/psnfss/ot1pnc.fd)
<15f8552d172b5a41c557b4ad371e3782.eps>
(/usr/share/texmf/tex/latex/psnfss/ot1phv.fd) [1]
(./15f8552d172b5a41c557b4ad371e3782.aux) )
Output written on 15f8552d172b5a41c557b4ad371e3782.dvi (1 page, 2268 bytes).
Transcript written on 15f8552d172b5a41c557b4ad371e3782.log.

dvips -R -T 12.750000in,18.030000in -o "/tmp/15f8552d172b5a41c557b4ad371e3782.ps" "/tmp/15f8552d172b5a41c557b4ad371e3782.dvi"

(test.py:7286): Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

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

Hope anyone can give me a hint.

cheers,
steve

--
Random number generation is the art of producing pure gibberish as quickly as possible.

I can't reproduce your result with pango 1.10.3 installed on a gentoo system
with python-2.4.2. Does the script crash if you set verbose.level=silent? It
looks like one of the stdout or stderr messages from dvips/gs/dvipng is
returning unicode, in which case you could try to convert them to strings
before passing them to verbose.report. Just a guess.

···

On Sunday 26 February 2006 6:37 am, Steve Schmerler wrote:

Hi

With 0.87 and 0.86.2 mpl randomly crashes when executing this script:

---------------------------
from pylab import *
from matplotlib import verbose

verbose.level = 'debug-annoying'
##verbose.level = 'debug'

rcParams['text.usetex'] = True
plot([1,2,3])

savefig("image.eps")
---------------------------

The crash is triggered when savefig() is called and only if
rcParams['text.usetex'] = True. The error message is

  (test.py:7258): Pango-WARNING **: Invalid UTF-8 string passed to
pango_layout_set_text()

I tried to track it down but the crash seems to occur in *different*
code segments (calling "python test.py" several times it crashed
sometimes after a call to dvips, sometimes dvipng, gs, ...). Sometimes
it even *doesn't* crash at all.

I have the following pango-stuff installed (Debian):

elcorto@...662...:~$ COLUMNS=200 dpkg -l | grep pango
ii libpango1.0-0 1.8.1-1

ii libpango1.0-common 1.8.1-1

ii libpango1.0-dbg 1.8.1-1

ii libpango1.0-dev 1.8.1-1

Darren Dale wrote:

···

On Sunday 26 February 2006 6:37 am, Steve Schmerler wrote:

Hi

With 0.87 and 0.86.2 mpl randomly crashes when executing this script:

---------------------------
from pylab import *
from matplotlib import verbose

verbose.level = 'debug-annoying'
##verbose.level = 'debug'

rcParams['text.usetex'] = True
plot([1,2,3])

savefig("image.eps")
---------------------------

The crash is triggered when savefig() is called and only if
rcParams['text.usetex'] = True. The error message is

(test.py:7258): Pango-WARNING **: Invalid UTF-8 string passed to
pango_layout_set_text()

I tried to track it down but the crash seems to occur in *different*
code segments (calling "python test.py" several times it crashed
sometimes after a call to dvips, sometimes dvipng, gs, ...). Sometimes
it even *doesn't* crash at all.

I have the following pango-stuff installed (Debian):

elcorto@...662...:~$ COLUMNS=200 dpkg -l | grep pango
ii libpango1.0-0 1.8.1-1

ii libpango1.0-common 1.8.1-1

ii libpango1.0-dbg 1.8.1-1

ii libpango1.0-dev 1.8.1-1

I can't reproduce your result with pango 1.10.3 installed on a gentoo system with python-2.4.2. Does the script crash if you set verbose.level=silent? It looks like one of the stdout or stderr messages from dvips/gs/dvipng is returning unicode, in which case you could try to convert them to strings before passing them to verbose.report. Just a guess.

Yes, with verbose.level = 'silent' the script runs and saves the image but in interactive use the interpreter crashes (an errow message window pops up, verbose.level: silent in matplotlibrc).

cheers,
steve

--
Random number generation is the art of producing pure gibberish as quickly as possible.