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

抓取报错 #19

Open
noood opened this issue Feb 14, 2022 · 1 comment
Open

抓取报错 #19

noood opened this issue Feb 14, 2022 · 1 comment

Comments

@noood
Copy link

noood commented Feb 14, 2022

大神来看下呀:

/Users/bo/PycharmProjects/pythonProject/main.py[line:550] - ERROR: 请求过程中出错了,出错信息为:Traceback (most recent call last):
File "/Users/bo/PycharmProjects/pythonProject/main.py", line 547, in
run(cellphone, pwd, exclude=exclude, get_comments=get_comments)
File "/Users/bo/PycharmProjects/pythonProject/main.py", line 513, in run
geek._article(aid, pro, file_type=file_type, get_comments=get_comments) # 获取单个文章的信息
File "/Users/bo/PycharmProjects/pythonProject/main.py", line 341, in _article
self.save_to_file(
File "/Users/bo/PycharmProjects/pythonProject/main.py", line 449, in save_to_file
os.mkdir(dir_path)
FileNotFoundError: [Errno 2] No such file or directory: 'A/B测试从0到1'

@MIDE-589
Copy link

MIDE-589 commented Aug 16, 2022

专栏名中有非法字符,所以无法创建目录。
我简单看了眼,作者写了一个check_filename函数用来过滤文件名中的斜杠,但没过滤目录名。
所以,在第446行下面加一句:
dir_name = check_filename(dir_name)
亲测可用

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

2 participants