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

Bug fixed AttributeError in RE_TKK.search #406

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fcoagz
Copy link

@fcoagz fcoagz commented May 18, 2024

no match was found for the regular expression RE_TKK in the text r.text.

    self._update()
    code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

a check was added to handle this case.

        code = self.RE_TKK.search(r.text)

        if code is not None:
            # this will be the same as python code after stripping out a reserved word 'var'
            code = code.group(1).replace('var ', '')
            # unescape special ascii characters such like a \x3d(=)
            code = code.encode().decode('unicode-escape')

the AttributeError error is avoided. In case you do not find a match

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

Successfully merging this pull request may close these issues.

1 participant