FileNotFoundError: [Errno 2] No such file or directory: './download/js-tutorial.html'

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/home/mac126/.pyenv/versions/3.6.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/home/mac126/Desktop/11/day1/spider_commplete.py", line 131, in run
    save_url(html_content,url_str)
  File "/home/mac126/Desktop/11/day1/spider_commplete.py", line 41, in save_url
    with open(file_path,'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: './download/js-tutorial.html'

这个错误很低级,不过还是写出来,希望大家引以为戒,不要像我一样粗心大意。

在项目目录添加一个文件夹就好

 

posted @ 2018-12-20 11:04  青春叛逆者  阅读(1752)  评论(0编辑  收藏  举报