Re: [Boa Constr] About Boa constructor 0.6.1
Status: Beta
Brought to you by:
riaan
From: Werner F. B. <wer...@fr...> - 2007-10-19 07:17:41
|
Hi Ianaré, ianaré sévi wrote: > I had to do some stuff in windows and am getting an ecoding problem. > We've had a lot of those of late, and I wanted to see if anything > could be done. > > WinXP home , wxpython 2.8 unicode, latest boa from CVS. > > My home directory is : "C:\Documents and Settings\ianaré" > (will my accent aigu comme out properly in your e-mails ? ) > Yeap, I can see it fine. > On load, Boa borks with : > > importing Inspector > Traceback (most recent call last): > File "Boa.py", line 711, in <module> > main() > File "Boa.py", line 693, in main > app = BoaApp() > File "Boa.py", line 497, in __init__ > wx.App.__init__(self, False) > File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7823 > , in __init__ > self._BootstrapApp() > File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7420 > , in _BootstrapApp > return _core_.PyApp__BootstrapApp(*args, **kwargs) > File "Boa.py", line 540, in OnInit > inspector = Inspector.InspectorFrame(self.main) > File "C:\Python25\Lib\site-packages\boa-constructor\Inspector.py", > line 157, in __init__ > cmpInf.append(self.paletteImages.Add(IS.load(filename))) > File "C:\Python25\Lib\site-packages\boa-constructor\ImageStore.py", > line 78, in load > imgpath, ext = self.pathExtFromName(rootpath, name) > File "C:\Python25\Lib\site-packages\boa-constructor\ImageStore.py", > line 69, in pathExtFromName > self.checkPath(imgPath) > File "C:\Python25\Lib\site-packages\boa-constructor\ImageStore.py", > line 98, in checkPath > raise InvalidImgPathError, _('%s not valid') %imgPath > UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 31: ordinal > not in range(128) > > ----------------------------------------------------- > > > I fixed this by editing "ImageStore.py" like so : > > > def pathExtFromName(self, root, name): > root = root.decode(sys.getfilesystemencoding()) > imgPath = self.canonizePath(os.path.join(root, name)) > ext = os.path.splitext(name)[1] > self.checkPath(imgPath) > return imgPath, ext > > > ".decode(sys.getfilesystemencoding())" is what I use in my > applications to handle this sort of problem. > I have to remember this one for my own stuff, also I always thought that Python/wxPython would handle these cases. What versions are you currently using? Werner |