Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52441
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-08-13 01:06 -0700 |
| Message-ID | <dac9bb94-a1e2-410b-b925-445a2c8b66a0@googlegroups.com> (permalink) |
| Subject | multithreading in python |
| From | samaneh.yahyapour@gmail.com |
hi
my program work by 4 thread but when i use more thread it terminates
i use opencv in my image_process.so
my code is :
#!/usr/bin/python
import sys
import os
import io
import time
import copy
import threading
import ctypes
class MyClass():
def __init__(self):
i = 0
while i<10:
thread1 = threading.Thread(target=self.item_thread)
thread1.start()
i = i+1
time.sleep(0.01)
def item_thread(self):
imageAnalyzer=ctypes.CDLL("../so/image_process.so")
imageAnalyzer.aref_img_score_init("/opt/amniran/etc/face.xml", "/opt/amniran/etc/porn.xml")
for filename in os.listdir("../script/images/"):
if filename[-4:] == ".jpg" or filename[-4:] == ".png" or filename[-4:] == ".gif" or filename[-5:] == ".jpeg" :
path = "../script/images/%s"%filename
fo = file(path, "r")
content = fo.read()
score = imageAnalyzer.score_image(content, len(content))
print "%d : %s " %(score, path)
print "ENDDDDDDDDDDDDDDDDDDDDDDDDDDDD"
x = MyClass()
how can i solve this problem
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
multithreading in python samaneh.yahyapour@gmail.com - 2013-08-13 01:06 -0700 Re: multithreading in python Steven D'Aprano <steve@pearwood.info> - 2013-08-13 08:38 +0000 Re: multithreading in python Dave Angel <davea@davea.name> - 2013-08-13 11:22 +0000 Re: multithreading in python Dave Angel <davea@davea.name> - 2013-08-13 11:40 +0000 Re: multithreading in python Terry Reedy <tjreedy@udel.edu> - 2013-08-13 11:51 -0400
csiph-web