clics / clics3

See also the Code Ocean capsule (https://codeocean.com/capsule/7201165/tree/v2) accompanying this project.
https://clics.clld.org
16 stars 3 forks source link

Python 3.10 workflow errors #26

Closed M0nochrome closed 2 months ago

M0nochrome commented 2 months ago

Seems like I have a problem getting past step 6. Upon entering the command

clics --seed 42 -t 3 -f families makeapp

I get the error: UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 672: character maps to

2024-08-10 17_02_53-C__WINDOWS_system32_cmd exe

I had similar problems in step 5 as well (encoding error there too) but I just downloaded the network-3-families.gml file

LinguList commented 2 months ago

Do you have the chance to test in non-windows? Windows now offers a direct Ubuntu integration. The error is that by default, Windows seems to assume a non-Unicode encoding.

Alternatively, can you fix in your clicks_env directly?

Try to replace this:

    @property
    def graph(self):
        def lines():
            for line in self.fname.open():
                yield line.encode('ascii', 'xmlcharrefreplace').decode('utf-8')
        return nx.parse_gml(''.join(lines()))

by

    @property
    def graph(self):
        def lines():
            for line in self.fname.open(coding="utf-8"): # try also coding="ascii"
                yield line.encode('ascii', 'xmlcharrefreplace').decode('utf-8')
        return nx.parse_gml(''.join(lines()))
LinguList commented 2 months ago

The coding="xyz"-attribute is probably having a different default in windows that causes the code error. But I cannot directly tell what we need, either "utf-8" or "ascii" would be my guess (I am not good at this, typically try out until I find a solution).

M0nochrome commented 2 months ago

You were right. I switched to the Ubuntu bash under windows and everything ran fine. The only problem I had was in step 4 where I had to break it in two loads, cause running it as is it produced some errors (forgot to screenshot).