Skip to content

Commit d9c85ba

Browse files
authored
Optimizing the run_tesseract command construction
1 parent a1cd93e commit d9c85ba

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/pytesseract.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,18 @@ def run_tesseract(input_filename, output_filename_base, lang=None, boxes=False,
3232
returns the exit status of tesseract, as well as tesseract's stderr output
3333
3434
'''
35-
command = [tesseract_cmd, input_filename, output_filename_base]
35+
command = []
3636

3737
if not sys.platform.startswith('win32') and nice != 0:
38-
command.insert(0, "nice")
39-
command.insert(1, "-n")
40-
command.insert(2, nice)
38+
command += ('nice', '-n', str(nice))
39+
40+
command += (tesseract_cmd, input_filename, output_filename_base)
4141

4242
if lang is not None:
43-
command += ['-l', lang]
43+
command += ('-l', lang)
4444

4545
if boxes:
46-
command += ['batch.nochop', 'makebox']
46+
command += ('batch.nochop', 'makebox')
4747

4848
if config:
4949
command += shlex.split(config)

0 commit comments

Comments
 (0)