I have the following code:
import wx
from sys import platform
wildcard = "CSV files|*.csv|"\
"XML files|*.xml|"\
"Microsoft Excel files|*.xlsx" if platform == "win32" else "CSV files|*.csv|"\
"XML files|*.xml|"
if __name__ == "__main__":
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
frame_1 = wx.Frame(None, -1, "")
app.SetTopWindow(frame_1)
frame_1.Show()
dlg = wx.FileDialog(
frame_1, message="Choose a file",
defaultDir="",
defaultFile="",
wildcard=wildcard, #PROBLEM IS HERE THAT'S FOR SURE
style=wx.OPEN
)
dlg.ShowModal() #IT CRASHES HERE
dlg.Destroy()
app.MainLoop()
This FileDialog works perfect in Windows and Linux but crashes in Mac OS X. Is there anything I could change in order to get FileDialog working properly in Mac OS X?
Python 2.7.3, wxPython 2.8, Mac OS X 10.6
UPDATE: Updated to be a small sample.
UPDATE 2: Without “wildcard” parameter it works great but I need wildcard anyway.
Just found answer myself:
http://trac.wxwidgets.org/ticket/4489
It crashes in Mac when wildcard improperly formatted, after removing last “|” in wildcard everything work just fine.