On 28.10.2015 16:05, Yannis Haralambous wrote:
> That is exactly what I did:
>
> # -*- coding: utf-8 -*-
>
> and then
>
> EDGE_LABEL=[u'∈']
>
> and the script file stored in UTF-8 without BOM.
>
> And here is the error I got:
>
> Traceback (most recent call last):
> File "apply-rules.py", line 473, in <module>
> execfile("rules.py")
> File "rules.py", line 13, in <module>
> signature=['204:6', '20456:4', '2045654:4', '45654:2', '456:2', '654:2',
> '2:3', '4:3', '6:1']
> File "apply-rules.py", line 292, in apply_edge_rule
> r=att_edge(q,KNOWN[ms[0][0]],KNOWN[ms[0][5]],globals()[ms[0][3]])
> File "apply-rules.py", line 351, in att_edge
>
> g.ep['labele'][res]=str(g.vp['labelv'][a])+"_"+EDGE_LABEL[val]+"_"+str(g.vp['labelv'][b])
> File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line
> 490, in __setitem__
> self.__map[key] = self.__convert(v)
> File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line
> 254, in convert
> return vtype(val)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u2208' in
> position 3: ordinal not in range(128)
The function does not expect unicode objects, but rather simply
strings. You should do simply:
EDGE_LABEL=[u'∈'.encode("utf-8")]
Best,
Tiago
--
Tiago de Paula Peixoto <[email protected]>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list [email protected] http://lists.skewed.de/mailman/listinfo/graph-tool
