Commit 0e4f556d by larosa

add exception handle

parent b4df46bb
Showing with 3 additions and 2 deletions
...@@ -216,6 +216,7 @@ if __name__ == '__main__': ...@@ -216,6 +216,7 @@ if __name__ == '__main__':
os.makedirs(extract_dir) os.makedirs(extract_dir)
"""unzip the zip file""" """unzip the zip file"""
try:
file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_1, extract_dir) file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_1, extract_dir)
file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_3, extract_dir) file_handle.unzip(conf_environment["tmp_file_path"] + local_file_name_3, extract_dir)
...@@ -227,8 +228,8 @@ if __name__ == '__main__': ...@@ -227,8 +228,8 @@ if __name__ == '__main__':
sys.exit("can't query the correct supplier id.") sys.exit("can't query the correct supplier id.")
handle_hk_csv(extract_dir + handle_file_name_1, conf_environment, rs_hk_supplier_id) handle_hk_csv(extract_dir + handle_file_name_1, conf_environment, rs_hk_supplier_id)
handle_cn_csv(extract_dir + handle_file_name_3, conf_environment, rs_cn_supplier_id) handle_cn_csv(extract_dir + handle_file_name_3, conf_environment, rs_cn_supplier_id)
except Exception as e:
print(e)
"""remove the temp file, close the connection""" """remove the temp file, close the connection"""
remove(extract_dir + handle_file_name_1) remove(extract_dir + handle_file_name_1)
remove(extract_dir + handle_file_name_3) remove(extract_dir + handle_file_name_3)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment