if not a valid csv file, ignore it in stock reconciliation patch
diff --git a/patches/january_2013/stock_reconciliation_patch.py b/patches/january_2013/stock_reconciliation_patch.py
index 26d8f4f..fa919f4 100644
--- a/patches/january_2013/stock_reconciliation_patch.py
+++ b/patches/january_2013/stock_reconciliation_patch.py
@@ -58,8 +58,13 @@
if stock_reco_file_path:
with open(stock_reco_file_path, "r") as open_reco_file:
content = open_reco_file.read()
- content = read_csv_content(content)
- reconciliation_json = json.dumps(content, separators=(',', ': '))
- webnotes.conn.sql("""update `tabStock Reconciliation`
- set reconciliation_json=%s where name=%s""", (reconciliation_json, reco))
+ try:
+ content = read_csv_content(content)
+ reconciliation_json = json.dumps(content, separators=(',', ': '))
+ webnotes.conn.sql("""update `tabStock Reconciliation`
+ set reconciliation_json=%s where name=%s""",
+ (reconciliation_json, reco))
+ except Exception:
+ # if not a valid CSV file, do nothing
+ pass
\ No newline at end of file