def get_vcode(path): with Image.open(path) as image: mutex.acquire(1) vcode = pytesseract.image_to_string(image, lang='numfont') mutex.release() return vcode.replace(',', '').replace('\n', '')