diff --git a/convert.py b/convert.py index 2549bcb..f4f4d7c 100644 --- a/convert.py +++ b/convert.py @@ -1,5 +1,6 @@ import fs import csv +import sys def parseRow(row, header): d = {} @@ -109,11 +110,11 @@ def convert(row): return row -def main(): +def main(inputFile): global Keys rows = [] csv.register_dialect('thing', delimiter=';', quoting=csv.QUOTE_ALL) - with open('coolhaven_2022.csv', mode ='r') as file: + with open(inputFile, mode ='r') as file: imp = csv.reader(file, 'thing') headers = False @@ -202,7 +203,13 @@ def main(): # yield parseRow(row, headers) if __name__ == '__main__': - main() + + print(sys.argv) + + if (len(sys.argv) == 2): + main(sys.argv[1]) + else: + print("please use one orgument for the path to the imputfile") # "Datum";"Naam / Omschrijving";"Rekening";"Tegenrekening";"Code";"Af Bij";"Bedrag (EUR)";"Mutatiesoort";"Mededelingen";"Saldo na mutatie";"Tag"