Fix filepath problem for non-Windows platforms

master
Dan Howe 6 years ago
parent 8b2a4901f7
commit 227ec54ab2

@ -121,11 +121,14 @@ def download_document(url, document_path):
# Check if destination path is too long (Windows filename limitation)
try:
# Create output directories as required
os.makedirs(os.path.dirname(document_path), exist_ok=True)
# Check if empty file can be created in this location
open(document_path, 'a').close()
except FileNotFoundError:
# Tweak long path for Windows
document_path = '\\\\?\\' + os.path.abspath(document_path)
# Create output directories as required
os.makedirs(os.path.dirname(document_path), exist_ok=True)
# Check if a non-empty file exists

@ -2,7 +2,7 @@ from setuptools import setup
setup(
name='major_projects_grabber',
version='0.2.0',
version='0.2.1',
packages=['major_projects_grabber'],
install_requires=['requests', 'lxml', 'tqdm'],
entry_points={

Loading…
Cancel
Save