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

运行错误报告?! #2

Open
ZhengPhilip opened this issue May 19, 2018 · 3 comments
Open

运行错误报告?! #2

ZhengPhilip opened this issue May 19, 2018 · 3 comments

Comments

@ZhengPhilip
Copy link

开始运行后,会不断弹出验证码,填完后会弹出这错误,需要如何调试?
UserWarning: style lookup by style_id is deprecated. Use style name as key instead.
warn(msg, UserWarning)

@Alfred1984
Copy link
Owner

  1. UserWarning不是运行错误哈,是python-docx这个安装包对于 document.add_paragraph(article['title'], style='ListNumber') 这段代码的一个提醒性警告,说新版本的python-docx对 style有调整,以后都要用style name 来指定你要使用的style,不能用之前的 style_id 来指定了。我们这里用 style='ListNumber' 正是遵循了它的规定,是没问题的。如果你不想看到这个警告,可以在前面加上:
    import warnings
    warnings.filterwarnings("ignore")
    这样就不会提示了。

  2. 由于目前验证码还不能完全自动识别,所以识别不了的验证码会弹出来人工识别;

  3. 运行到出现UserWarning的时候,应该是程序已经运行完毕了。新生成的文件可以到文件保存路径下查看。

@ZhengPhilip
Copy link
Author

问题解决了,谢谢大佬!^_^

@ZhangHanAA
Copy link

D:\Anadoda\python.exe D:/pachong/article_collector.py
please input code: azwk
Traceback (most recent call last):
File "D:/pachong/article_collector.py", line 74, in
articles = get_articles(timedel=1)
File "D:/pachong/article_collector.py", line 28, in get_articles
articles.extend(reformat(ws_api.get_gzh_article_by_history(account)))
File "D:\Anadoda\lib\site-packages\wechatsogou\api.py", line 382, in get_gzh_article_by_history
return WechatSogouStructuring.get_gzh_info_and_article_by_history(resp.text)
File "D:\Anadoda\lib\site-packages\wechatsogou\structuring.py", line 375, in get_gzh_info_and_article_by_history
'gzh': WechatSogouStructuring.get_gzh_info_by_history(text),
File "D:\Anadoda\lib\site-packages\wechatsogou\structuring.py", line 240, in get_gzh_info_by_history
profile_img = get_first_of_element(profile_area, 'div[1]/span/img/@src')
File "D:\Anadoda\lib\site-packages\wechatsogou\tools.py", line 56, in get_first_of_element
content = element.xpath(sub)
AttributeError: 'str' object has no attribute 'xpath'

运行公众号爬虫出现这个错误

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