title: How do I select a different language in pytesseract? I tried few methods but none worked
body: <p>I have tried different ways to pass the language but none worked. Here is the code:</p>
  <pre><code>dataframe_final=[]
  for i in range(len(boxes_list)):
    for j in range(len(boxes_list[i])):
      s=''
      if(len(boxes_list[i][j])==0):
          dataframe_final.append(' ')
      else:
          for k in range(len(boxes_list[i][j])):
              y,x,w,h = boxes_list[i][j][k][0],boxes_list[i][j][k][1], 
              boxes_list[i][j][k][2],boxes_list[i][j][k][3]
              roi = bitnot[x:x+h, y:y+w]
              kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 1))
              border = cv2.copyMakeBorder(roi,2,2,2,2, 
              cv2.BORDER_CONSTANT,value=[255,255])
              resizing = cv2.resize(border, None, fx=2, fy=2, 
              interpolation=cv2.INTER_CUBIC)
              dilation = cv2.dilate(resizing, kernel,iterations=1)
              erosion = cv2.erode(dilation, kernel,iterations=2)   
              plotting = plt.imshow(erosion,cmap='gray')
              plt.title(&quot;After Erosion&quot;)
              plt.show()             
              out = pytesseract.image_to_string(erosion)
              if(len(out)==0):
                  out = pytesseract.image_to_string(erosion)
              s = s +&quot; &quot;+ out
              dataframe_final.append(s)
  </code></pre>
  <p>print(dataframe_final)</p>
  <p>Now if I pass <em>pytesseract.image_to_string(erosion, lang='fra')</em> it doesn't work. Is there a way to pre define the language or another solution??
  Here is the Image produced after erosion:</p>
  <p><a href="https://i.stack.imgur.com/ALkno.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ALkno.png" alt="enter image description here" /></a></p>