PCQRSCANER/venv/Scripts/textract

34 lines
727 B
Plaintext
Raw Normal View History

2019-12-22 21:51:47 +01:00
#!C:\Users\mikol\PycharmProjects\skanerqr\venv\Scripts\python.exe
# -*- mode: python -*-
# PYTHON_ARGCOMPLETE_OK
"""
Command-line application.
"""
import sys
from textract.cli import get_parser
from textract import process
from textract.exceptions import CommandLineError
from textract.colors import red
# extract text
def main():
"""Interpret the command-line arguments, process the document and
raise errors accordingly (with traceback surpressed).
"""
parser = get_parser()
args = parser.parse_args()
try:
output = process(**vars(args))
except CommandLineError as ex:
sys.stderr.write(red(ex) + '\n')
sys.exit(1)
else:
args.output.write(output)
main()