Laws icon indicating copy to clipboard operation
Laws copied to clipboard

在本地运行脚本遇到问题

Open mechigonft opened this issue 1 year ago • 6 comments

报错:2024-01-02 15:03:31,538:DEBUG:parsing 中华人民共和国公司法 <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> document /flfg/WORD/15526420544a4ad18df391c0d8a88a6b.docx not exists 2024-01-02 15:03:32,180:ERROR:parsing 中华人民共和国公司法 error 2024-01-02 15:03:33,383:DEBUG:parsing 中华人民共和国粮食安全保障法 <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> document /flfg/WORD/0bbd8205d3174aa4a0bb86dca7ed5d3d.docx not exists 2024-01-02 15:03:33,426:ERROR:parsing 中华人民共和国粮食安全保障法 error 2024-01-02 15:03:34,732:DEBUG:parsing 中华人民共和国刑法修正案(十二) <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> document /flfg/WORD/2640f79d1b524fd2ad20535352365be4.docx not exists 2024-01-02 15:03:34,774:ERROR:parsing 中华人民共和国刑法修正案(十二) error 2024-01-02 15:03:35,995:DEBUG:parsing 中华人民共和国爱国主义教育法 <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1007)> document /flfg/WORD/924d7f3d723f49df9669c3af0760df5e.docx not exists 2024-01-02 15:03:36,054:ERROR:parsing 中华人民共和国爱国主义教育法 error

mechigonft avatar Jan 02 '24 07:01 mechigonft

这个路径是个什么路径呢? document /flfg/WORD/15526420544a4ad18df391c0d8a88a6b.docx not exists

mechigonft avatar Jan 02 '24 07:01 mechigonft

看了一下,__cache__文件夹下面的words文件夹里面没有内容

mechigonft avatar Jan 02 '24 07:01 mechigonft

已经解决,将https://github.com/LawRefBook/Laws/blob/master/scripts/manager/request.py#L109 代码修改成: import ssl context = ssl._create_unverified_context()

with urllib.request.urlopen(url, context=context) as response: # 打开文件用于写入 with open(path, 'wb') as out_file: # 读取响应内容并写入文件 out_file.write(response.read())

mechigonft avatar Jan 02 '24 08:01 mechigonft

unverified_context 并没有解决问题;应该是你本机证书 或者时间啥的 都问题,导致校验不过

RanKKI avatar Jan 02 '24 10:01 RanKKI

我现在脚本跑通了,而且也没有报错了,我看__cache__/words文件夹下面也成功下载了文件,请问你说的没有解决问题是指?难道我现在脚本实际上还有问题吗?

mechigonft avatar Jan 02 '24 11:01 mechigonft

现在日志是这样的 成功的日志

mechigonft avatar Jan 02 '24 11:01 mechigonft