From c4908077f1a1ccef5299b4e7e328135a550307a1 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Tue, 21 Aug 2018 10:49:50 +1000 Subject: [PATCH] Fix bug which downloaded only the first file in a folder --- major_projects_grabber/major_projects_grabber.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/major_projects_grabber/major_projects_grabber.py b/major_projects_grabber/major_projects_grabber.py index de19c6d..ee88659 100644 --- a/major_projects_grabber/major_projects_grabber.py +++ b/major_projects_grabber/major_projects_grabber.py @@ -128,8 +128,8 @@ def download_document(url, document_path): # Create output directories as required os.makedirs(os.path.dirname(document_path), exist_ok=True) - # Check if file exists - if os.path.isfile(document_path): + # Check if a non-empty file exists + if os.path.isfile(document_path) and os.path.getsize(document_path) > 0: pass else: try: