From 46b943f4b121c1850ea26e64fe8cefad36b0adf4 Mon Sep 17 00:00:00 2001 From: Jakub Czajka Date: Sun, 12 Nov 2023 12:34:38 +0100 Subject: [PATCH] Hardcode /tmp instead of tempfile. tempfile does not resolve to '/tmp' on MacOS. --- gdrive_knife.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/gdrive_knife.py b/gdrive_knife.py index 605ea7e..312805f 100644 --- a/gdrive_knife.py +++ b/gdrive_knife.py @@ -6,7 +6,6 @@ import io import os.path import shutil import sys -import tempfile import uuid import zipfile @@ -44,8 +43,8 @@ def get_drive_client(authentication_token): def get_path_on_drive(file_path): if os.path.isabs(file_path): - return tempfile.gettempdir() + file_path - return tempfile.gettempdir() + '/' + file_path + return '/tmp' + file_path + return '/tmp/' + file_path def get_file_id(drive, file_path): path_on_drive = get_path_on_drive(file_path) @@ -126,7 +125,7 @@ def download(args): request = drive.files().get_media(fileId=maybe_id, acknowledgeAbuse=True) - path_in_tmp = tempfile.gettempdir() + '/' + str(uuid.uuid4()) + path_in_tmp = '/tmp/' + str(uuid.uuid4()) with io.FileIO(path_in_tmp, mode='wb') as stream_input: downloader = MediaIoBaseDownload(stream_input, request) done = False -- 2.39.5