Segfault while calling wx.html.WebView.New() on Debian 12 i686

Hello everybody,

I have got a virtual machine to be able to compile stuff for the i386 Linux platform. It’s a Debian 12 (Bookworm).

I am trying to install wxPython into a virtual Python environment. Tried several methods but let’s stick with the standard one via pip.

After install, I am getting this:

(pyvenv) pavel@LazarOS ~/build $ python                
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> import wx.html2
>>> app = wx.App()
>>> wx.version()
'4.2.1 gtk3 (phoenix) wxWidgets'
>>> frm = wx.Frame()
>>> wv = wx.html2.WebView.New(frm)
Segmentation fault

I got to the venv solution just because my system wxPython does basically the same:

pavel@LazarOS ~/build $ python
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> import wx.html2
>>> app = wx.App()
>>> wx.version()
'4.2.0 gtk3 (phoenix) wxWidgets 3.2.2'
>>> frm = wx.Frame()
>>> wv = wx.html2.WebView.New(frm)
Segmentation fault

What am I doing wrong?

Here is my system info:

  Host: LazarOS Kernel: 6.1.0-12-686-pae arch: i686 bits: 32 compiler: gcc
    v: 12.2.0 Desktop: MATE v: 1.26.0 Distro: Debian GNU/Linux 12 (bookworm)
  Type: Virtualbox System: innotek GmbH product: VirtualBox v: 1.2
    serial: <superuser required>
  Mobo: Oracle model: VirtualBox v: 1.2 serial: <superuser required>
    BIOS: innotek GmbH v: VirtualBox date: 12/01/2006
  ID-1: BAT0 charge: 28.0 Wh (56.0%) condition: 50.0/50.0 Wh (100.0%)
    volts: 10.0 min: 10.0 model: innotek 1 status: not charging
  Info: dual core model: Intel Core i5-7200U bits: 32 type: MCP
    arch: Amber/Kaby Lake note: check rev: 9 cache: L1: 128 KiB L2: 512 KiB
    L3: 6 MiB
  Speed (MHz): avg: 2712 min/max: N/A cores: 1: 2712 2: 2712 bogomips: 10847
  Flags: avx avx2 ht nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
  Device-1: VMware SVGA II Adapter driver: vmwgfx v: bus-ID: 00:02.0
  Display: x11 server: X.Org v: driver: X: loaded: vmware
    unloaded: fbdev,modesetting,vesa dri: swrast gpu: vmwgfx
    resolution: 1920x957~60Hz
  API: OpenGL v: 4.5 Mesa 22.3.6 renderer: llvmpipe (LLVM 15.0.6 256 bits)
    direct-render: Yes
  Device-1: Intel 82801AA AC97 Audio vendor: Dell driver: snd_intel8x0
    v: kernel bus-ID: 00:05.0
  API: ALSA v: k6.1.0-12-686-pae status: kernel-api
  Server-1: PulseAudio v: 16.1 status: active
  Device-1: Intel 82540EM Gigabit Ethernet driver: e1000 v: kernel port: d020
    bus-ID: 00:03.0
  IF: enp0s3 state: up speed: 1000 Mbps duplex: full mac: 08:00:27:42:48:30
  Device-2: Intel 82371AB/EB/MB PIIX4 ACPI type: network bridge
    driver: piix4_smbus v: N/A port: N/A bus-ID: 00:07.0
  Local Storage: total: 40 GiB used: 703.76 GiB (1759.4%)
  ID-1: /dev/sda vendor: VirtualBox model: VBOX HARDDISK size: 40 GiB
  ID-1: / size: 38.14 GiB used: 10.29 GiB (27.0%) fs: ext4 dev: /dev/sda1
  ID-1: swap-1 type: partition size: 975 MiB used: 26 MiB (2.7%)
    dev: /dev/sda5
  Src: lm-sensors+/sys Message: No sensor data found using /sys/class/hwmon
    or lm-sensors.
  Processes: 137 Uptime: 1d 4h 34m Memory: 3.88 GiB used: 847.8 MiB (21.4%)
  Init: systemd target: graphical (5) Compilers: gcc: 12.2.0 Packages: 1718
  Shell: Bash v: 5.2.15 inxi: 3.3.26

I am eager to give you any info you would need, including wxPython compilation (beware, I am a beginner in this task an failed in this effort multiple times recently but with your help I could succeed).

Hi @Cigydd,

should be:

>>> frm = wx.Frame(None)


WOW! Such a dumb and newbie mistake! :laughing:

I must have been really tired from the previous compilation experiments while leaving out this nonsense. :laughing:

Thank you so much for your clarification and your patience. Now I can build and even run the application I was going to build with PyInstaller!

So for other desperate people who run into this: Always pass at least None to the wx.Frame constructor if you don’t have any parent window to create it on (so that your Frame is an orphan :wink:). Typically if it’s the only frame or the top one in your application.