Re: About Boa constructor 0.6.1

"ianaré sévi" <[email protected]>
Newsgroups gmane.comp.ide.boa-constructor.user
Message-ID <[email protected]>
I might have sent this message already, but it vanished (not in
outbox) when I hit "send"... weird.

winXP home, wxpy 2.8 unicode, boa from CVS.

I was having a problem with accents in the path. My home folder is :
"C:\Documents andSettings\ianaré"

Opening boa on first run gave me this :

  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 it by editing ImageStore.py, starting at line 65 :

    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 all my unicode
applications for this kind of problem.

Cheers !

-- 
- ianaré sévi


2007/10/18, Riaan Booysen <[email protected]>:
> Hi Werner,
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.