Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cython check error: "object has no attribute 'chunk'" #44

Closed
henla464 opened this issue May 4, 2022 · 2 comments
Closed

Cython check error: "object has no attribute 'chunk'" #44

henla464 opened this issue May 4, 2022 · 2 comments
Labels

Comments

@henla464
Copy link

henla464 commented May 4, 2022

I tried to use cython and installed with
sudo python3 setup.py install --native-compile

Installation seem to have worked but I get this error calling the check method:

File "creedsolo.pyx", line 870, in creedsolo.RSCodec.check
AttributeError: 'RSCodec' object has no attribute 'chunk'

Am I doing something wrong?

@henla464
Copy link
Author

henla464 commented Jun 4, 2022

Changing the check function in creedsolo.pyx to the below code seem to fix the issue.

def check(self, data, nsym=None):
        '''Check if a message+ecc stream is not corrupted (or fully repaired). Note: may return a wrong result if number of errors > nsym.'''
        if not nsym:
            nsym = self.nsym
        if isinstance(data, str):
            data = bytearray(data)
        check = []
        for i in xrange(0, len(data), self.nsize):
            # Split the long message in a chunk
            chunk = data[i:i+self.nsize]
            check.append(rs_check(chunk, nsym, fcr=self.fcr, generator=self.generator))
        return check

@lrq3000
Copy link
Collaborator

lrq3000 commented Dec 9, 2022

You are totally right, thank you very much, next time open a PR so you can be directly credited, but I mentioned you in the commit, have a great day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants