I am on Windows7, using Python 2.6 and wxPython 2.8.10.1. I am trying to get this Open File dialog to work but am running into a weird error. This looks like a valid wildcard string to me, but whenever I choose a file and click 'Ok' on the File Dialog, I get this:
Traceback (most recent call last):
File "D:\Projects\python\wxTest.py", line 92, in OnOpen
self.__DoOpen()
File "D:\Projects\python\wxTest.py", line 101, in __DoOpen
if open_dlg.ShowModal() == wx.ID_OK:
File "C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_windows.py", line 711, in ShowModal
return _windows_.Dialog_ShowModal(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at
..\..\src\common\filefn.cpp(1746) in wxParseCommonDialogsFilter():
missing '|' in the wildcard string!
When the dialog is open everything looks fine. Any ideas?
EDIT: typing too fast, forgot to include the wildcard string in question! sorry...
wcd = "All files(*.*)|*.*|Text files (*.txt)|*.txt|"
open_dlg = wx.FileDialog(self, message='Choose a file', defaultDir=directory, defaultFile='', style=wx.OPEN | wx.CHANGE_DIR)
open_dlg.SetWildcard(wcd)
if open_dlg.ShowModal() == wx.ID_OK:
path = open_dlg.GetPath()
...