Last active
October 8, 2016 11:20
-
-
Save swayson/9130ff43a2f4ba308c065f43fe6f8551 to your computer and use it in GitHub Desktop.
Simple boilerplate code to setup a Python program.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import glob | |
try: | |
import ujson as json | |
except ImportError: | |
import ujson as json | |
import argparse | |
argparser = argparse.ArgumentParser( | |
description='Arguments that may be parsed.', epilog="The Epilog") | |
argparser.add_argument('--test', action='store_true', | |
help='Simulate the Run') | |
argparser.add_argument('--dir', '-d', type=str, required=True, | |
help='Required variable "dir" with the following text as its value. i.e. --dir /test/123/ ') | |
argparser.add_argument('--optionaldefault', '-o', default="the default value", | |
type=str, help='Creates a variable "optionaldefault" ') | |
argparser.add_argument('--integer', '-i', default=0, type=int, | |
help='Creates a variable "integer" with the value 0 if nothing is specified.') | |
args = argparser.parse_args() | |
def main(args): | |
pass | |
if __name__ == "__main__": | |
try: | |
main(args) | |
except Exception: | |
raise | |
else: | |
pass | |
finally: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment