def main(argv): config = "~/.portfolio.json" # cli arguments try: opts, args = getopt.getopt(argv,"hs:",[]) except getopt.GetoptError: usage() for opt, arg in opts: if opt == '-h': usage() elif opt == '-s': config = arg try: p = Portfolio(open(config).read()) p.print_table() except IOError: print 'portfolio file not found!' sys.exit(1)