Can't start new thread python
Программа перебирает 5 тысяч строк. На каждую строку получается запускается 1 новый потоп. Спустя 500-600 строк выдает can't start new thread и перестает работать. Как это решить?
import aminofix
import requests
import time
import threading
from threading import Thread
def gg():
wiki = lines.split(" ")
devic = wiki[2]
device = devic[0:82]
print(device)
client = aminofix.Client(device)
print(wiki[0], wiki[1], wiki[2])
try:
client.login(wiki[0], wiki[1])
print(client.sid)
with open("sid.txt", "a") as file:
sidd = str("sid=")+str(client.sid)
file.writelines(f"{str(sidd)}\n")
except: pass
while True:
with open("accounts.txt", "r+") as file:
for lines in file:
threading.Thread(target=gg).start()
time.sleep(0.1)
Источник: Stack Overflow на русском