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

报错:AttributeError: 'NoneType' object has no attribute 'group' #1

Open
ZAISHUI04 opened this issue Nov 30, 2024 · 3 comments
Open

Comments

@ZAISHUI04
Copy link

11月29号运行之后,在输入目标课程时报错:
Traceback (most recent call last):
File "D:\Desktop\Welearn_helper-main (1)\welearn_accuracy.py", line 110, in
uid = re.search(r"uid=(\d+)", script.text).group(1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

查找对应报错地点,我看之前有部分您注释掉的原作者的代码

uid = re.search('"uid":(.*?),', response.text).group(1)

classid = re.search('"classid":"(.*?)"', response.text).group(1)

当我注释您的,使用原作者的代码,程序又能正常运行。
因为我并没有学过python,并不能深究报错缘由,也只是凭运气修改,期待您有更好的解决办法。

@nanmu123456
Copy link

请问解决了吗,我前两天运行也是报这个错误,按照您说的方法更改之后也不行,现在运行之后报:错误返回,登录失败!
不知道怎么回事

@ZAISHUI04
Copy link
Author

我改后是可以运行的,我今天试了一下,如果你需要的话,我上传到我的仓库,有需要来下载

@YZBRH
Copy link
Owner

YZBRH commented Dec 1, 2024

很抱歉现在才看到您的issue,该问题确实存在,应该是接口返回的数据有所变化,导致正则匹配失败,按照您的方法修改即可,我已提交修改

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

No branches or pull requests

3 participants