From: Jakub Czajka Date: Sun, 12 Nov 2023 11:34:38 +0000 (+0100) Subject: Hardcode /tmp instead of tempfile. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=46b943f4b121c1850ea26e64fe8cefad36b0adf4;p=gdrive_knife.git Hardcode /tmp instead of tempfile. tempfile does not resolve to '/tmp' on MacOS. --- 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