May-17-2021, 09:15 PM
When you run the program you need to pass an argument. The program checks this, but in the wrong place. Your code should look like this:
To use this program you will use a command like "python knab.py somefilename" where "somefilename" is the name of a file that appears to contain transactions.
if len(sys.argv) < 2: print "No input file name given!" exit() bank = Bank(sys.argv[1]) bank.gencsvk()Now if you forget to provide a filename you will get the informative message "No input file name given!" instead of an obscure error message about index out of range.
To use this program you will use a command like "python knab.py somefilename" where "somefilename" is the name of a file that appears to contain transactions.