.cnblogs 模拟登录时出现几个错误

来源:4-8 . cnblogs模拟登录(新增内容)

红萼

2021-11-30

Chrome : 版本 96.0.4664.45(正式版本) (64 位)
操作系统 : Windows 10 64 bit [10.0.19042]
python : Python 3.9.4

在 .cnblogs 模拟登录时出现如下几个错误:

  1. raise RuntimeError(’’'
    RuntimeError:
    An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.

     This probably means that you are not using fork to start your
     child processes and you have forgotten to use the proper idiom
     in the main module:
    
         if __name__ == '__main__':
             freeze_support()
             ...
    
     The "freeze_support()" line can be omitted if the program
     is not going to be frozen to produce an executable.
    
  2. AttributeError: ‘Chrome’ object has no attribute ‘service’

上网查询答案无法解决,请求大家帮助,谢谢!

写回答

2回答

慕神2158989

2021-12-01

我刚刚网上搜到答案,在main页中加入这句话“if __name__ == '__main__':”,就没出现了

0
4
Jynine
回复
魈仔
在main.py中加 : from multiprocessing import freeze_support if __name__ == '__main__': from scrapy.cmdline import execute import sys import os print(os.path.dirname(__file__)) print(__file__) print(os.path.dirname(os.path.abspath(__file__))) sys.path.append(os.path.dirname(os.path.abspath(__file__))) execute(["scrapy","crawl","cnblogs"])
2022-02-10
共4条回复

慕神2158989

2021-12-01

我也是同样的问题

0
0

Scrapy打造搜索引擎 畅销4年的Python分布式爬虫课

带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎

5829 学习 · 6293 问题

查看课程