I just ran into a pretty wierd problem. I'm using wxPython version
'2.5.2.8u' built against GTK-2.0 from source on a Debian GNU/Linux
testing (sarge) system on an i386. I'm using Python-2.3.4.
I basically have a ZIP file called hello.zip with a trivial hello.py
file that just prints "hello". If I import hello from this file
*after* I import wx, I get a segfault. OTOH, if I just do 'import
zlib' before I import wx I avoid the segfault. Here is more detail.
This is seg.py:
# ---------- seg.py ---------- #import zlib
import wx
import sys
sys.path.append('/tmp/hello.zip') # Fix the path to suit your need.
import hello
# ----------------------------------------
hello.zip contains one file called hello.py which is like so:
# ---------- hello.py ----------
"""A simple test module to see if zipfiles do indeed
break with wxPython."""
The docstring above merely triggers compression. The zip file is made
like so:
$ zip hello.zip hello.py
Simply run seg.py like so:
$ python seg.py
This segfaults for me. If you un-comment the import zlib, everything
works ok.
gdb is not much use here. But here is a stack trace anyway.
(gdb) bt #0 inflate_blocks_reset (s=0x0, z=0xbfffe650, c=0x0) at infblock.c:73 #1 0x40460b72 in inflateReset (z=0xbfffe650) at inflate.c:63 #2 0x412c2646 in inflateInit2_ () from /usr/lib/libz.so.1 #3 0x40019769 in initzlib () from /usr/lib/python2.3/lib-dynload/zlib.so #4 0xfffffff1 in ?? () #5 0x4001adc0 in ?? () from /usr/lib/python2.3/lib-dynload/zlib.so #6 0x00000038 in ?? ()
[...]
This does not seem to happen with other modules that link to libz.so.1
(like pygtk).
I've attached the hello.zip and seg.py files just in case.
I just ran into a pretty wierd problem. I'm using wxPython version
'2.5.2.8u' built against GTK-2.0 from source on a Debian GNU/Linux
testing (sarge) system on an i386. I'm using Python-2.3.4.
I basically have a ZIP file called hello.zip with a trivial hello.py
file that just prints "hello". If I import hello from this file
*after* I import wx, I get a segfault. OTOH, if I just do 'import
zlib' before I import wx I avoid the segfault. Here is more detail.
This is seg.py:
# ---------- seg.py ---------- #import zlib
import wx
import sys
sys.path.append('/tmp/hello.zip') # Fix the path to suit your need.
import hello
# ----------------------------------------
hello.zip contains one file called hello.py which is like so:
# ---------- hello.py ----------
"""A simple test module to see if zipfiles do indeed break with wxPython."""
The docstring above merely triggers compression. The zip file is made
like so:
$ zip hello.zip hello.py
Simply run seg.py like so:
$ python seg.py
This segfaults for me. If you un-comment the import zlib, everything
works ok.
gdb is not much use here. But here is a stack trace anyway.
(gdb) bt #0 inflate_blocks_reset (s=0x0, z=0xbfffe650, c=0x0) at infblock.c:73 #1 0x40460b72 in inflateReset (z=0xbfffe650) at inflate.c:63 #2 0x412c2646 in inflateInit2_ () from /usr/lib/libz.so.1 #3 0x40019769 in initzlib () from /usr/lib/python2.3/lib-dynload/zlib.so #4 0xfffffff1 in ?? () #5 0x4001adc0 in ?? () from /usr/lib/python2.3/lib-dynload/zlib.so #6 0x00000038 in ?? ()
[...]
This does not seem to happen with other modules that link to libz.so.1
(like pygtk).
I've attached the hello.zip and seg.py files just in case.
Given all things, I would guess that wx has it's own version of zlib (an older version) such that if you import zlib first, you get the latest python version. If you import wx first, you get a different version.
>> I just ran into a pretty wierd problem. I'm using wxPython
[...]
> Given all things, I would guess that wx has it's own version
> of zlib (an older version) such that if you import zlib first,
> you get the latest python version. If you import wx first, you
> get a different version.
That was my first guess too. Unfortunately, all the wxPython modules
link to the same library that lib-dynload/zlib.so links to. Of
course, it is possible that libz.so has changed since I built
wxPython, but I find it hard to believe that this could cause the
problem. If the library libz.so is shared by all the modules
involved, why does this happen?
Does anyone else see the same behavior or is it just me?
I just ran into a pretty wierd problem. I'm using wxPython version
'2.5.2.8u' built against GTK-2.0 from source on a Debian GNU/Linux
testing (sarge) system on an i386. I'm using Python-2.3.4.
I basically have a ZIP file called hello.zip with a trivial hello.py
file that just prints "hello". If I import hello from this file
*after* I import wx, I get a segfault. OTOH, if I just do 'import
zlib' before I import wx I avoid the segfault. Here is more detail.
wxWidgets can be built such that it uses its own copy of zlib instead of the one on the system. My guess is that it is doing so and that there is an incompatibility between the two. Try rebuilding wxWidgets/wxPython such that it is forced to use the system's zlib (it's a configure flag).
Oops, I see in a later message that you've already checked that. I think I would still rebuild though, just in case.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
[...]
>> I basically have a ZIP file called hello.zip with a trivial
>> hello.py file that just prints "hello". If I import hello from
>> this file *after* I import wx, I get a segfault. OTOH, if I
>> just do 'import zlib' before I import wx I avoid the segfault.
>> Here is more detail.
> wxWidgets can be built such that it uses its own copy of zlib
> instead of the one on the system. My guess is that it is
> doing so and that there is an incompatibility between the two.
> Try rebuilding wxWidgets/wxPython such that it is forced to
> use the system's zlib (it's a configure flag).
> Oops, I see in a later message that you've already checked
> that. I think I would still rebuild though, just in case.
Thanks for the response. I could rebuild wxPython, but it takes a
fairly long while to build on my old machine. I checked all the
installed wxWidgets libraries using ldd and they all are linked to the
system zlib library. BTW, does the script I sent segfault for you?
Since that did not work, I rebuilt wxPython again and this time added
a --with-zlib=builtin to configure. The problem is gone. Strange but
true.
Strange. That is the opposite of what I expected. Perhaps there is something in how that particular version of zlib is initialized that doesn't play well if it is used from more than one source...
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!