From e5bc04cce1f9c2b4e5099e3c22ed27b451bd4b0a Mon Sep 17 00:00:00 2001 From: Fitti Date: Thu, 29 Apr 2021 08:57:57 +0200 Subject: [PATCH] Fix filepath formatting for Windows --- clipper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/clipper.py b/clipper.py index 6a2281f..532ce66 100644 --- a/clipper.py +++ b/clipper.py @@ -5,7 +5,7 @@ import json import urllib.request as dl import sys -from os.path import isfile, isdir, realpath +from os.path import isfile, isdir, realpath, basename from os.path import join as pjoin from os import remove, makedirs, listdir from datetime import datetime, timedelta @@ -136,7 +136,8 @@ def dl_progress(count, block_size, total_size): args = parser.parse_args() filepath = realpath(__file__) - filedir = "/".join(filepath.split("/")[:-1]) + "/" + filename = basename(filepath) + filedir = filepath[:-len(filename)] gdrive_credentials = pjoin(filedir, "credentials.txt")