Bob Klahn wrote:
I'm using the above function inside a wx.grid cell renderer:
class CellRenderer(gridlib.PyGridCellRenderer):
def __init__(self):
gridlib.PyGridCellRenderer.__init__(self)
self.filter = utils.makefilter('{}\x08\x0C',delete=True)
The problem: When the cell renderer executes and the filter is invoked (e.g., as self.filter(word) ), it fails on the
return s.translate(allchars, delchars)
line in makefilter:
TypeError: translate() takes exactly one argument (2 given)I.e, Python thinks that string s is a Unicode string. But I'm not using Unicode strings anywhere! Any ideas where wxPython might be changing my plain strings into Unicode strings? I'm not able to provide a simple code example.
Filters generated by makefilter work perfectly outside of my wxPython application.
Where does word come from? Have you checked it's type? UnicodeBuild - wxPyWiki
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!