python - Webapp2 temp pytesseract with AppEngine -
the algorithm process deleting captcha lines saves in temp_cap variable , use pytesseract read characters not allow me error of 'input_file_name ='% s.bmp '% tempnam ()', using webapp appengine suggestion give me?
def bypass(type,dni): session = requests.session() if type=='xxx': cnn =session.get('https://zyz.xzy.duh.ye/val/codigo.do') img=image.open(string.stringio(cnn.content)) img = img.convert("rgba") pixdata = img.load() y in xrange(img.size[1]): x in xrange(img.size[0]): red, green, blue, alpha=pixdata[x, y] if blue<100: pixdata[x, y] = (255, 255, 255, 255) temp_cap=pytesseract.image_to_string(img) temp_cap=temp_cap.strip().upper() captcha_val='' in range(len(temp_cap)): if temp_captcha_val[i].isalpha() or temp_cap[i].isdigit(): captcha_val=capt+temp_cap[i] traceback (most recent call last): file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1535, in __call__ rv = self.handle_exception(request, response, e) file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__ rv = self.router.dispatch(request, response) file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher return route.handler_adapter(request, response) file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__ return handler.dispatch() file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) file "/google/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch return method(*args, **kwargs) file "/home/fullmarketperu/src/api-reniec/python_gae_quickstart-2017-08-11-11-16/appengine/standard/hello_world/main.py", line 30, in temp_captcha_val=pytesseract.image_to_string(img) file "/home/fullmarketperu/src/api-reniec/python_gae_quickstart-2017-08-11-11-16/appengine/standard/hello_world/pytesseract/pytesseract.py", line 110, in image_to_string input_file_name = '%s.bmp' % tempnam() file "/home/fullmarketperu/src/api-reniec/python_gae_quickstart-2017-08-11-11-16/appengine/standard/hello_world/pytesseract/pytesseract.py", line 78, in tempnam tmpfile = tempfile.namedtemporaryfile(prefix="tess_") file "/google/google-cloud-sdk/platform/google_appengine/google/appengine/dist/tempfile.py", line 61, in placeholder raise notimplementederror("only tempfile.temporaryfile available use") notimplementederror: tempfile.temporaryfile available use
wiki
Comments
Post a Comment