Re: About Boa constructor 0.6.1
"ianaré sévi" <[email protected]>
| Newsgroups | gmane.comp.ide.boa-constructor.user |
|---|---|
| Message-ID | <[email protected]> |
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 ? )
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.
OK cool now I can get into Boa and have some fun.
2007/10/18, Riaan Booysen <[email protected]>:
> Hi Werner,
>
> Werner F. Bruhin wrote:
> >>e.g. Boa.py -U utf-8
> >
> > That doesn't look like it works for me, e.g.:
> >
> > C:\Python25\Lib\site-packages\boa\Boa.pyw -O .boa-constructor-mine -U
> > iso8859-1
> >
> > import wx
> > >>> wx.GetDefaultPyEncoding()
> > 'utf-8'
> >
> > 'utf-8' is what is defined in my sitecustomize.py and if I remove it and
> > the .pyc and .pyo I get:
> >
> > import wx
> > >>> wx.GetDefaultPyEncoding()
> > 'cp1252'
>
> I'm not sure what will happen if you mix sitecustomize with
> the -U parameter, as far as I understand it, -U should override
> sitecustomize, but from your example it looks like it doesn't.
>
> I guess don't mix them.
>
> BTW, is sys.getdefaultencoding() the same as wx.GetDefaultPyEncoding()?
>
> I'd guess sys.setdefaultencoding() must just be called before wx is
> imported.
>
>
> This is what I get:
>
> Boa.py -U utf-8
>
> >>> import sys
> >>> sys.getdefaultencoding()
> 'utf-8'
> >>> import wx
> >>> wx.GetDefaultPyEncoding()
> 'utf-8'
>
>
> Boa.exe -U utf-8
>
> >>> import sys
> >>> sys.getdefaultencoding()
> 'utf-8'
> >>> import wx
> >>> wx.GetDefaultPyEncoding()
> 'utf-8'
>
> Cheers,
> Riaan.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Boa-constructor-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/boa-constructor-users
>
--
- ianaré sévi
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Boa-constructor-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boa-constructor-users