@Helvetosaur wrote:
I am getting an error in the rs.CheckListBox() method, and it seems to be some kind of weird unicode problem.
Here is the test script:
#!/usr/bin/env python # -*- coding: utf-8 -*- import rhinoscriptsyntax as rs names=["Default","0","Existant"] #names=["Default","0","Existant","à démolir"] name_list=[(name,False) for name in names] print name_list msg="Pick an item" CLB=rs.CheckListBox(name_list,msg) for item in CLB: if item[1]: print "Chosen: {}".format(item[0])
Which runs OK. Now uncomment line #7 (the one that has the list with 2 accented characters) and run it again.
It errors out with
"Message: Unable to translate bytes [E0] at index 0 from specified code page to Unicode."
Now these are standard accented characters, notably typed with à = Alt+0224 and é = Alt+0233 . Normally they are accepted as long as I have the
#!/usr/bin/env python # -*- coding: utf-8 -*-
at the top of the script. So what is going on here?
Note that the
print name_list
line also spits out this:
[('Default', False), ('0', False), ('Existant', False), (u'\xe0 d\xe9molir', False)]
Is this some sort of bug, or am I doing something wrong?
Thanks, --Mitch
Posts: 8
Participants: 4