python3. 7. Cannot join thread before it is started, to be solved

Posted by limke on Mon, 10 Jan 2022 20:11:20 +0100

Problem Description:

July 28, 2021 17:34:5
After adding a blocking thread to return to the origin:
The code is as follows:

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


'''
    The top 10 data of Tencent position and write excel, There are 10 messages per page
    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 # first page URL
    
'''


class Tencent(unittest.TestCase):
    def setUp(self):    # Initialization method
        self.driver = webdriver.Chrome(executable_path="D:\Python_module\chromdriver\chromedriver.exe")
        self.driver.maximize_window()

    def testTencent(self):  # Test method, beginning with test
        # self.driver.get("https://www.baidu.com")

        # for i in range(1, 3):
        #     threading.Thread(target=self.crawl(i), name = "thread" + str (I)) start()
        #     threading.Thread(target=self.crawl(i), name = "thread" + str (I)) join()
        threading.Thread(target=self.crawl(1), name="thread " + str(1)).start()
        threading.Thread(target=self.crawl(2), name="thread " + str(2)).start()
        threading.Thread(target=self.crawl(3), name="thread " + str(3)).start()
        threading.Thread(target=self.crawl(4), name="thread " + str(4)).start()
        threading.Thread(target=self.crawl(1), name="thread " + str(1)).join()
        threading.Thread(target=self.crawl(2), name="thread " + str(2)).join()
        threading.Thread(target=self.crawl(3), name="thread " + str(3)).join()
        threading.Thread(target=self.crawl(4), name="thread " + str(4)).join()

    def crawl(self, page_nmb):
        print(page_nmb)
        self.driver.get("https://careers.tencent.com/search.html?query=co_1&index=" + str(page_nmb) + "&sc=1")
        time.sleep(2)
        self.driver.find_elements_by_class_name("recruit-title")[1].click()
        handle_list = self.driver.window_handles
        self.driver.switch_to.window(handle_list[1])
        time.sleep(3)
        job_content = self.driver.find_elements_by_class_name("work-module")
        print(job_content[0].text)
        print(job_content[1].text)
        self.driver.close()
        self.driver.switch_to.window(handle_list[0])
        time.sleep(2)
        # self.driver.switch_to.window(handle_list[0])
        # self.driver.close()

    def tearDown(self):
        self.driver.quit()  # Exit driver Chrome()


if __name__ == "__main__":
    unittest.main()

The operation results are as follows:

D:\Python37-32\python.exe "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.2\plugins\python-ce\helpers\pycharm_jb_unittest_runner.py" --target 13Selenium4.Tencent.testTencent
Testing started at 5:26 PM ...
Launching unittests with arguments python -m unittest 13Selenium4.Tencent.testTencent in D:\pyFile
1
operating duty
1. Responsible for the content direction planning and content delivery strategy of Tencent games on long and short video / community / live broadcasting platforms, so as to achieve the core purpose of driving game distribution through content dissemination;
2. Through innovative operation means, combined with the characteristics and playing methods of various content platforms, improve the ability of content with game distribution, and continue to explore and precipitate effective operation modes;
3. In the whole life cycle of the game, combined with the content / operation explosion points of major nodes, help the game optimize the content distribution efficiency on each platform.
Job requirements
1. Bachelor degree or above, more than 2 years of relevant working experience, and have a deep understanding of the full set of business ideas and methods of content band distribution in the content-based Channel - Live / short video platform;
2. Familiar with content type platform game vertical MCN resource pool and game big V, with short video, official account and other new media platform operation experience is preferred.
3. Familiar with the business ideas of content publicity and content production pipeline;
4. Have strong copywriting language ability, be good at capturing hot spots and creating topics, have rich creative experience in mainstream content forms (Graphic / short video, etc.), and be able to optimize content marketing model through data;
5. Be sensitive to industry and user data, be able to predict industry trends according to data, and plan and layout in advance.
2
operating duty
Be responsible for customizing brand strategy and product strategy, and be able to write the whole case independently;
Assist the project team to grasp the direction of R & D and distribution and make the products closer to the user's perspective;
Refine the core information of the brand / product in the communication area to drive the overall communication planning and communication wire;
Have a preliminary grasp of social interaction, big data, user experience and content marketing, and can cooperate with the marketing department to complete the integrated communication plan;
Assist in the development of new business, new channel and new media.
Job requirements
At least 3 years working experience in advertising or communication, at least 1 year working experience in strategy, working experience in 4A company and industry background experience in Digital or Social company;
Have independent strategy writing ability and can write the whole case;
Be able to independently put forward their own strategic views based on strategic needs, such as communication, brand, market competition, user portrait and other analysis contents;
Master the skills of digging insight and inspire creative teams through insight;
Have the ability of brief, and can put forward a clear and easy to understand brief for more conventional communication projects;
It is better to understand the market, consumer groups and communication environment of the game industry.
3
operating duty
1. Improve public opinion data monitoring indicators, build a public opinion data platform and write analysis reports to promote game project optimization and improve users' overall satisfaction with the game.
2. Use tools, Internet search and other forms to monitor the public opinion of products on network related platforms, report and record them in time, and promote the implementation and solution of projects for problems.
3. Through data mining and exploration, analyze user behavior data, rationality of game numerical design and other information, and promote the coordination of key contents such as R & D adjustment, operation direction, content planning and resource investment according to the analysis results.;
4. Conduct special data analysis for game projects, including but not limited to user value, loss, game ecology, activity version effect, etc., comprehensively evaluate and output reports.
Job requirements
1.2 years or above relevant working experience, and those with experience in secondary game public opinion analysis, market research and community operation can be relaxed appropriately;
2. Be familiar with the information related to media platforms, understand their communication channels and characteristics, pay attention to current events, have objective and profound views on public events, and have the ability to write independent case analysis reports is preferred;
3. Have good rapid response ability, logical thinking ability and analysis ability, and have good teamwork ability;
4. Familiar with secondary meta community and core user groups is preferred.
4
operating duty
1. Responsible for controlling the creative concept of various game projects in marketing nodes and brand construction, discussing the core selling points of products with relevant market and product personnel, and outputting the planning scheme of the core creative concept;
2. Work with art directors to link internal and external execution resources to ensure the effective implementation of concepts to execution;
3. Excavate and cultivate design and production resources that can be used by the project for a long time.
Job requirements
1. More than three years of Internet marketing creative post or senior writing experience in advertising industry, with good writing skills and aesthetic ability.
2. Excellent creative planning, proposal and summary ability;
3. Be able to have an in-depth understanding of the product, tap the cultural value of the product, and effectively link with the user's emotion at the information level through effective writing means
Have rich game experience, be familiar with the dynamics of the game industry at home and abroad, have an in-depth understanding of games, animation, movies and other fields, and have a strong sensitivity to high-quality writing cases.
1
operating duty
1. Responsible for the advertising operation and promotion of mobile boutique mobile games;
2. Be responsible for the formulation of effect advertising strategies for different categories of games, formulate effect advertising promotion strategies, and coordinate and promote the implementation of effect advertising strategies;
3. Be responsible for game launch data analysis, be able to conduct multi-dimensional analysis around launch data, locate launch problems and optimize launch strategies;
4. Responsible for studying the advertising strategy and effect of competitive products and peers, and reusing effective experience.
Job requirements
1. Bachelor degree or above;
2. At least 3 years working experience in mobile game operation, familiar with mobile advertising process, experience in mobile game advertising is preferred;
3. Familiar with the effect of different categories of products, advertising promotion and return model;
4. Excellent organization and coordination ability and planning ability;
5. Sensitive to data, able to implement work under high pressure;
6. Have excellent self driving force, communication ability, team cooperation ability and cross departmental cooperation driving force.
Error
Traceback (most recent call last):
File "D:\pyFile\13Selenium4.py", line 33, in testTencent
threading.Thread(target=self.crawl(1), name = "thread" + str (1)) join()
File "D:\Python37-32\lib\threading.py", line 1027, in join
raise RuntimeError("cannot join thread before it is started")
RuntimeError: cannot join thread before it is started
Ran 1 test in 43.047s
FAILED (errors=1)
Process finished with exit code 1

Problem solving:

To be solved

Topics: Python thread