python3.7 ,cannot join thread before it is started, 待解决

这篇博客主要记录了在Python3.7环境下遇到的线程错误:RuntimeError: cannot join thread before it is started。作者在代码中尝试加入一个阻塞线程时遇到了该问题,目前问题尚未解决。博客内容涉及到线程的创建和操作,以及相关异常的处理。
摘要由CSDN通过智能技术生成

问题描述:

2021年7月28日17:34:5
添加了一个阻塞线程之后,以回到了原点:
代码以如下:

# -*- coding=utf-8 -*-
import threading
import time
import unittest
from selenium import webdriver


'''
    腾讯职位的前 10 位数据, 并写入 excel, 每页有 10 条信息
    https://careers.tencent.com/search.html?query=co_1&sc=1
    (https://careers.tencent.com/search.html?query=co_1&index=1&sc=1)
    https://careers.tencent.com/search.html?query=co_1&index=2&sc=1
    https://careers.tencent.com/search.html?query=co_1&index=3&sc=1     # 第一页的 URL
    
'''


class Tencent(unittest.TestCase):
    def setUp(self):    # 初始化方法
        self.driver = webdriver.Chrome(executable_path="D:\Python_module\chromdriver\chromedriver.exe")
        self.driver.maximize_window()

    def testTencent(self):  # 测试方法 ,test 开头
        # self.driver.get("https://www.baidu.com")

        # for i in range(1, 3):
        #     threading.Thread(target=self.crawl(i), name="线程" + str(i)).start()
        #     threading.Thread(target=self.crawl(i), name="线程" + str(i)).join()
        threading.Thread(target=self.crawl(1), name="线程" + str(1)).start()
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值