Skip to content

It's not possible to use a character whitelist with a spacebar on windows #575

@art0007i

Description

@art0007i

I hope I am not overlooking something obvious but from my experiments it seems not possible to use a character whitelist which has a spacebar in it on windows

I tried:
pytesseract.image_to_string(img, config=conf)
where conf is
"--psm 6 -c tessedit_char_whitelist=' 0123456789'"
'--psm 6 -c tessedit_char_whitelist=" 0123456789"'
"--psm 6 -c tessedit_char_whitelist=\' 0123456789\'"
'--psm 6 -c tessedit_char_whitelist=\" 0123456789\"'

none of those worked, it seems that the underlying code is running shlex.split with posix=False on windows. this makes it ALWAYS split on a spacebar ignoring quotes, I edited pytesseract's source code to set posix=True even on windows and it fixed my issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions