make inputfile an argument

This commit is contained in:
MReenen 2022-12-31 14:09:20 +01:00
parent 0dedf0967f
commit f114faf2d2

View File

@ -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"