[wxPython] Segfault while loading image.

Hello.

I have a very short script, that just loads an image from a png (or gif, or
any format). Under Windows XP I have no problem but under Debian Linux it
raises a segmentation fault.

Config:
- Debian woody
- Python 2.1
- wxgtk-python2.2

I attach the incrimined file (very short).

icons.py (2.19 KB)

In my experience, it is necessary to first create a wxApp object before
manipulating images. just add

myapp = wxPySimpleApp()

before creating any bitmap objects

-Mark

···

On Tue, 2002-06-04 at 06:14, Erwan Loisant wrote:

Hello.

I have a very short script, that just loads an image from a png (or gif, or
any format). Under Windows XP I have no problem but under Debian Linux it
raises a segmentation fault.

Config:
- Debian woody
- Python 2.1
- wxgtk-python2.2

I attach the incrimined file (very short).

I have a very short script, that just loads an image from a png (or gif, or

any format). Under Windows XP I have no problem but under Debian Linux it
raises a segmentation fault.

Config:
- Debian woody
- Python 2.1
- wxgtk-python2.2

I attach the incrimined file (very short).

IIRC, with wxGTK 2.2x if you tried to import this file before the wxApp
object was created then it could cause a segfault. Try delaying its import
(i.e. don't import it at global scope but inside the function where it is
used,) and see if that makes a difference. If so then you can either update
to 2.3 (I think) or reorganize this module such that the bitmaps are not
created at import time, but upon first use.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

IIRC, with wxGTK 2.2x if you tried to import this file before the wxApp
object was created then it could cause a segfault. Try delaying its

import

(i.e. don't import it at global scope but inside the function where it is
used,) and see if that makes a difference. If so then you can either

update

to 2.3 (I think) or reorganize this module such that the bitmaps are not
created at import time, but upon first use.

This is right. Thank you.

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxpython-users@lists.wxwindows.org>
Sent: Wednesday 05 June 2002 3:28
Subject: Re: [wxPython] Segfault while loading image.