Cairo demo crashes on msw

I found this exact problem on the old mailing list posted back in May
(Nabble: http://www.nabble.com/Problem-running-Cairo-demo-tt23406281.html#a23406281),
although it appears it was never solved.

To recap:

I am using python 2.6.2, with wx-2.8-msw-unicode, and pycairo with
(cairo 1.8.6-1) obtained from http://www.wxpython.org/cairo/. I am
running Windows Vista.

I run the Cairo demo from wxPython 2.8 demos and is crashes
immediately. There is no stack trace. Just like in the other case,
Cairo_Snippets works without a problem. The problem seems to be
around the fonts.

I can replace

    face = wx.lib.wxcairo.FontFaceFromFont(
        wx.FFont(10, wx.SWISS, wx.FONTFLAG_BOLD))
    ctx.set_font_face(face)

with these lines

    ctx.select_font_face ("Sans", cairo.FONT_SLANT_NORMAL,
                 cairo.FONT_WEIGHT_BOLD)

to make the crash go away. Of course, it's using the "toy" font
system, so it is generally not the desired way to fix it. Can anyone
help?

Ralph

ralph wrote:

I found this exact problem on the old mailing list posted back in May
(Nabble: http://www.nabble.com/Problem-running-Cairo-demo-tt23406281.html#a23406281),
although it appears it was never solved.

To recap:

I am using python 2.6.2, with wx-2.8-msw-unicode, and pycairo with
(cairo 1.8.6-1) obtained from Index of /cairo. I am
running Windows Vista.

I run the Cairo demo from wxPython 2.8 demos and is crashes
immediately. There is no stack trace. Just like in the other case,
Cairo_Snippets works without a problem. The problem seems to be
around the fonts.

I can replace

    face = wx.lib.wxcairo.FontFaceFromFont(
        wx.FFont(10, wx.SWISS, wx.FONTFLAG_BOLD))
    ctx.set_font_face(face)

with these lines

    ctx.select_font_face ("Sans", cairo.FONT_SLANT_NORMAL,
                 cairo.FONT_WEIGHT_BOLD)

to make the crash go away. Of course, it's using the "toy" font
system, so it is generally not the desired way to fix it. Can anyone
help?

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC Frank was still having a problem with it. Unfortunately, if I can't duplicate it I can't do much about solving it. It will likely take somebody who is having the problem to make a debug build of Python, wxWidgets and wxPython and then run it under the debugger to see what is going on.

···

--
Robin Dunn
Software Craftsman

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what is
going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

···

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

BTW2, I still have the same problem on gtk2. It appears to work initially,
but if I resize the window it crashes. The tracebacks vary, but here is a
typical one -

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what is
going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what is
going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what is
going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what is
going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

BTW2, I still have the same problem on gkt2. It appears to work, but if I
resixe the window, it crashes. The traceback varies, but this is a typical
one -

Traceback (most recent call last):
  File "Cairo.py", line 31, in OnPaint
    self.Render(dc)
  File "Cairo.py", line 72, in Render
    wx.FFont(10, wx.SWISS, wx.FONTFLAG_BOLD))
  File
"/usr/local/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/lib/wxcairo.p
y", line 164, in FontFaceFromFont
    fontface =
pycairoAPI.FontFace_FromFontFace(ctypes.c_void_p(fontfaceptr))
cairo.Error: <unknown error status>

I am still using python 2.6.1 on gtk2 - I will try to find the time to
upgrade to 2.6.2 and see if this makes any difference.

Frank Millman

Apologies for that very garbled message - please ignore that one and use
this one -

Robin Dunn wrote:

ralph wrote:
> I found this exact problem on the old mailing list posted back in
> May
> (Nabble: http://www.nabble.com/Problem-running-Cairo-demo-
tt23406281.html#a23406281),
> although it appears it was never solved.
>

The only crash I was able to reproduce was fixed in 2.8.10.1, but IIRC
Frank was still having a problem with it. Unfortunately, if I can't
duplicate it I can't do much about solving it. It will likely take
somebody who is having the problem to make a debug build of Python,
wxWidgets and wxPython and then run it under the debugger to see what
is going on.

Here is an update which is probably more confusing than helpful, but I think
it is encouraging.

My previous report, in June, stated the following -

···

==================================
I installed python 2.6.1, wxpython 2.8.10.1, and wxcairo 1.8.6, together
with the 3 dll's, on an old Windows 2000 Server machine, and had the same
problem.

Then I took a spare hdd, put it in the W2K machine, installed Windows XP
Pro, then installed python, wxpython, and wxcairo exactly the same as
before, and it works!

So there seems to be some issue with Windows 2000/2003.

In the interim, my laptop was stolen and I have temporarily set up a desktop
machine as a replacement. I had not re-installed cairo, but having read this
thread I have now installed it, and lo and behold - it works.

The only change I can think of is that I am now using python 2.6.2 instead
of 2.6.1 - could this make a difference?

BTW, I battled to get cairo working at first. If I typed 'import cairo', I
got an error message saying that it could not locate the DLL.

I had initially downloaded the following zip files from
www.gtk.org/download-windows.html -

cairo_1.8.8-2_win32.zip
libpng_1.2.38-1_win32.zip
zlib123-dll.zip

After getting nowhere, I tried, more in hope than expectation, the zip files
from wxpython.org/cairo -

cairo_1.8.6-1_win32.zip
libpng_1.2.34-1_win32.zip
zlib123-dll.zip

After unpacking, the DLL names were the same as before, but when I copied
them into my PATH, everything worked.

BTW2, I still have the same problem on gkt2. It appears to work, but if I
resixe the window, it crashes. The traceback varies, but this is a typical
one -

Traceback (most recent call last):
  File "Cairo.py", line 31, in OnPaint
    self.Render(dc)
  File "Cairo.py", line 72, in Render
    wx.FFont(10, wx.SWISS, wx.FONTFLAG_BOLD))
  File
"/usr/local/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/lib/wxcairo.p
y", line 164, in FontFaceFromFont
    fontface =
pycairoAPI.FontFace_FromFontFace(ctypes.c_void_p(fontfaceptr))
cairo.Error: <unknown error status>

I am still using python 2.6.1 on gtk2 - I will try to find the time to
upgrade to 2.6.2 and see if this makes any difference.

Frank Millman

ralph wrote:

I found this exact problem on the old mailing list posted back in May
(Nabble:
http://www.nabble.com/Problem-running-Cairo-demo-tt23406281.ht

ml#a23406281),

although it appears it was never solved.

I am the one who originally reported this problem.

As I have mentioned in another message, I recently rebuilt my machine from
scratch, and magically the problem has gone away. All versions of software
are the same as before except that I am now using python 2.6.2 instead of
2.6.1. I do not believe that this could make a difference.

I have one suggestion for the OP to try. It is possible that, by rebuilding
my machine, I have got rid of some old version of a dll or similar that
might have been called instead of the correct one.

Check the names of the three dll's downloaded, and search your system to see
if there are any others with similar names. Either delete or rename them, or
alternatively adjust your PATH environment variable so that the new dll's
are the first ones to be found.

This is pure speculation, but it is worth a try.

Frank Millman