Skip to content
Snippets Groups Projects
Commit 4e3a45df authored by Natasha Pavlovikj's avatar Natasha Pavlovikj
Browse files

Add condition to check if file is empty before uploading it to MongoDB

parent aef122dc
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ parser.add_argument("-f", "--file", dest="file", required=True, help="Path to re
parser.add_argument("-m", "--meta", dest="meta", required=True, help="Path to meta yaml file.")
args = parser.parse_args()
if os.path.isfile(args.file) and os.path.isfile(args.meta):
if os.path.isfile(args.file) and os.path.isfile(args.meta) and os.path.getsize(args.file) > 0:
mdb = chipathlon.db.MongoDB(args.host, args.username, args.password)
with open(args.meta, "r") as rh:
meta = yaml.load(rh)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment