<s> from __future__ import ( <EOL> absolute_import , <EOL> print_function , <EOL> unicode_literals , <EOL> ) <EOL> import sys <EOL> import logging <EOL> from pydocx import PyDocX <EOL> def convert ( output_type , docx_path , output_path ) : <EOL> if output_type == '<STR_LIT>' : <EOL> output = PyDocX . to_html ( docx_path ) <EOL> elif output_type == '<STR_LIT>' : <EOL> output = PyDocX . to_markdown ( docx_path ) <EOL> else : <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:2> <EOL> with open ( output_path , '<STR_LIT:wb>' ) as f : <EOL> f . write ( output . encode ( '<STR_LIT:utf-8>' ) ) <EOL> return <NUM_LIT:0> <EOL> def usage ( ) : <EOL> print ( '<STR_LIT>' ) <EOL> return <NUM_LIT:1> <EOL> def main ( args = None ) : <EOL> logging . basicConfig ( level = logging . DEBUG ) <EOL> if args is None : <EOL> return usage ( ) <EOL> try : <EOL> output_type = args [ <NUM_LIT:0> ] <EOL> docx_path = args [ <NUM_LIT:1> ] <EOL> output_path = args [ <NUM_LIT:2> ] <EOL> except IndexError : <EOL> return usage ( ) <EOL> return convert ( output_type , docx_path , output_path ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> sys . exit ( main ( args = sys . argv [ <NUM_LIT:1> : ] ) or <NUM_LIT:0> ) </s>
