python_scripts
python_scripts copied to clipboard
一些python相关的演示代码
>ubuntu 16.04 ``` $ wkhtmltopdf --version wkhtmltopdf 0.12.2.4 ```
周半部分的好多图片下载失败,是不是wkhtmltopdf分配的缓存太小了。因为失败的图片总是后半部分的图。而错误信息也没有提示什么有用的: Traceback (most recent call last): File "crawler.py", line 165, in crawler.run() File "crawler.py", line 99, in run pdfkit.from_file(htmls, self.name + ".pdf", options=options) File "D:\Program Files\Python36\lib\site-packages\pdfkit\api.py", line 49, in from_file...
 在html的时候是正常的,应该是转pdf的时候变了,是options设置不对吗?  在Mac下做的。
运行 `heart.py`,`response.json()[0]` 报错: ``` raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded ``` 新浪微博API返回的是html,并不是json格式,因此报错
Traceback (most recent call last): File "crawler.py", line 56, in parse_url_to_html f.write(html) TypeError: a bytes-like object is required, not 'str' During handling of the above exception, another exception occurred: Traceback...
运行后能生成pdf文件,但是cmd里面会显示错误。  还有,那些HTML文件也没有删除
一点小错误
在windows10下pip需要安装beautifulsoup4 不加4 默认安装的是3. 在win ubuntu全提示字符错误 windows `ERROR:root:瑙f瀽閿欒 Traceback (most recent call last): File "crawler.py", line 56, in parse_url_to_html html = html.encode("utf-8") UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position...
The only way I could do this was to make sure I didn’t have any issues.