Python Main NUM_ARGS = 1

N.B. Replace ‘example’ with ‘myFileNameWITHOUT.py’ creates a RUNNING Python Program.

# -*- coding: utf-8 -*-
r"""example.py DoesSomethingTo INFILEPATH (FILE CONTENTS DESCRIPTION) Producing FILL_IN_HERE
Usage:   ./example.py INFILENAME
Sample:  ./example.py myInFileName   
"""
import sys, os, fnmatch, shutil, json
 
def example(infilename):
    indirpath = 'outPDFparseJSON'
    infilepath = os.path.join(indirpath, infilename)
    infilename_root, infilename_ext = os.path.splitext(infilename)
    print()
    print (infilepath)
    print (indirpath)
    print (infilename)
    print (infilename_root)
    print (infilename_ext)
 
    outdirpath = 'outPyObjList'
    outfilename = infilename_root + '_filled' + infilename_ext
    outfilepath = os.path.join(indirpath, outfilename)
    print(outfilepath) 
 
NUM_ARGS = 1
def main():
    args = sys.argv[1:]
    if len(args) != NUM_ARGS or "-h" in args or "--help" in args:
        print (__doc__)
        sys.exit(2)
    example(args[0])

if __name__ == '__main__':
    main()

#main, #python, #pythonmain