Commits

Robert Brewer committed 642334c

Fixed up csvutil main

  • Participants
  • Parent commits 295b48e

Comments (0)

Files changed (1)

flowrate/csvutil.py

             postdate = datetime.date(year, month, day)
             self.add_tx(credit, debit, amount, postdate, tx['Description'])
 
-    # https://wwws.mint.com/transactionDownload.event?startDate=01/01/2012&endDate=01/31/2012
-
 
 class ErrorGatheringMintImporter(MintImporter):
 
 if __name__ == '__main__':
     import sys
     try:
-        csvfilename = sys.argv[1]
-    except IndexError:
-        print "csvutil requires a CSV file argument."
+        csvfilename, configfilename = sys.argv[1:]
+    except ValueError:
+        print "csvutil requires a CSV file and config file arguments."
         sys.exit(1)
 
-    from flowrate.testing import config
+    config = simplejson.loads(open(configfilename, 'rb').read())
     flowrate.set_db(
         'postgresql://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s' %
-        config.db_info, echo=False, max_overflow=10, strategy="threadlocal")
+        config['db_info'], echo=False, max_overflow=10, strategy="threadlocal")
 
     csvfile = open(csvfilename, 'rb')
     CommandLineMintImporter().load_mint_csv(csvfile)