diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/cusip_universe.py | 2 | ||||
| -rw-r--r-- | python/load_intex_collateral.py | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/python/cusip_universe.py b/python/cusip_universe.py index 4dc9c998..91d9aa4f 100644 --- a/python/cusip_universe.py +++ b/python/cusip_universe.py @@ -38,7 +38,7 @@ def upload_data(workdate, conn, cursor): continue line["dealname"] = line["dealname"].lower() dealname = line['dealname'] - line = {k: convertToNone(v) for k, v in line.iteritems()} + line = {k: convertToNone(v) for k, v in line.items()} if dealname not in dealupdate: cursor.execute("SELECT \"Latest Update\" FROM clo_universe " \ "WHERE dealname = %s ORDER BY \"Latest Update\" DESC", (dealname,)) diff --git a/python/load_intex_collateral.py b/python/load_intex_collateral.py index 4325c9aa..5c710920 100644 --- a/python/load_intex_collateral.py +++ b/python/load_intex_collateral.py @@ -38,7 +38,7 @@ def upload_data(dealnames, workdate, conn, cursor): #dealname, updatedate = line.rstrip().split() # updatedate = datetime.datetime.strptime(updatedate, '%m/%d/%Y') #dealname = dealname.upper() + ",AD.txt - with open( os.path.join(common.root, "data", "Collaterals_" + workdate, dealname.upper() + "_AD.txt"), "r") as fh: + with open( os.path.join(common.root, "data", "Collaterals_" + workdate, dealname.upper() + "_AD.txt"), "r", encoding='windows-1252') as fh: dr = csv.DictReader(fh, dialect = 'excel-tab') missingfields = set(fields) - set(dr.fieldnames) if "LoanX ID" in missingfields: @@ -61,7 +61,7 @@ def upload_data(dealnames, workdate, conn, cursor): print("dubious id found: {0}".format(line['LoanX ID'])) line['LoanX ID'] = line['LoanX ID'][:8] # make sure the string is utf8 safe - line['Issuer'] = line['Issuer'].decode('windows-1252') + line['Issuer'] = line['Issuer'] if 'Reinvest Collat' not in missingfields and \ line['Reinvest Collat'].upper() == 'Y' or line['Issuer'] == '': # assume it's a reinvestment asset @@ -107,7 +107,7 @@ def upload_data(dealnames, workdate, conn, cursor): sqlstr = "SELECT count(*) FROM et_collateral where dealname = %s and updatedate= %s" cursor.execute(sqlstr, (dealname, updatedate)) currlen = cursor.fetchone()[0] - if currlen <> len(data): + if currlen != len(data): print("{0} has {1} rows in the database and current collateral file has {2}".format(dealname, currlen, len(data))) sqlstr = "DELETE FROM et_collateral where dealname = %s and updatedate = %s" cursor.execute(sqlstr, (dealname, updatedate)) |
