Always "Segmentation fault: 11" when using wx.html2.WebViewHandler on macOS Mojave Python

At first, thanks for the great WxPython toolkit.
My issue is kindof connected to Segmentation fault when using a custom file system handler.

In GitHub as #1396 # Always “Segmentation fault: 11” when using wx.html2.WebViewHandler on macOS Mojave Python.

Operating system: macOS Mojave
wxPython version & source: pip, wxPython 4.0.6
Python version & source: pyenv, Python 3.7.0

Description of the problem:

Console output “Segmentation fault: 11” and macOS gives prompt telling “Python quit unexpectly”

class WebViewMddHandler(wx.html2.WebViewHandler):
    def __init__(self): 
        wx.html2.WebViewHandler.__init__(self, 'mdd')
    
    def GetFile(self, uri):
        print(uri)
        return None

browser = wx.html2.WebView.New(self.panel_1, wx.ID_ANY, style=0)
browser.RegisterHandler(WebViewMddHandler())

By the way, I really need some documentation to tell how to use wx.html2.WebViewHandler and wx.FileSystemHandler since the current documentation is really poor! And the so called zip handler is also not existed!

Is there anyone who can tell me how to fix this issue?

See:

The zip handlers are now called wx.ArchiveFSHandler and wx.html2.WebViewArchiveHandler.

Thanks for your kindly help. The samples/html2 is also wonderful!

However, by upgrading to the newest 4.1.0a1.dev4434+c6a1bad4, there comes another issue, which is classic but still quite tricky - Pyenv ValueError: unknown locale: UTF-8 #1437.

It seems to be not a issue of WxPython, nor PyEnv, nor Python, however, I really have no idea how it appears. Since this is a new issue after I upgrade to 4.1.0a1.dev, there could possibly also wxpython related.

Do you have any idea about this issue? Is there a way to avoid this Exception when using wxpython?

I was worried that that change might cause problems, but if it’s failing in locale.getlocale() then it is almost certainly a pyenv problem. I didn’t expect that this function could be a failure point.

Just to be sure that wx is not triggering the problem somehow, please try testing locale.getlocale() without importing wx, and also try the same with a stock python.

I’ll wrap that line in a try…except anyway as there is a reasonable fallback available.

Thanks again. A try … except block would be great to make the console clean. In fact, I tried to add a try…exept but faild since I am not clear where should I put this declaration.