From dc8ad39c63989c02ea7cc52ee35c861e572d605e Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 8 Jul 2019 14:11:16 -0300 Subject: Fix logdir --- grab-queue | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/grab-queue b/grab-queue index d9959a9..54bad32 100755 --- a/grab-queue +++ b/grab-queue @@ -69,15 +69,15 @@ class DownloadMultiple: # Heuristics to check if dest is a folder if local_filename[-1] == '/': - folder = local_filename - log_sep = folder + '../logs/' + folder = local_filename + logdir = folder + '../logs/' else: - folder = os.path.dirname(local_filename) - log_sep = '' + folder = os.path.dirname(local_filename) + logdir = '' self.ensuredir(folder) - with open(log_sep + 'grab-queue.log', "a") as log: + with open(logdir + 'grab-queue.log', "a") as log: log.write('Downloading ' + url + '...') # Set opts @@ -95,7 +95,7 @@ class DownloadMultiple: stdout, stderr = await proc.communicate() if stdout: - output = open(local_filename + log_sep + domain + '.stdout', 'w') + output = open(logdir + domain + '.stdout', 'w') output.write(stdout.decode()) output.close() @@ -103,18 +103,18 @@ class DownloadMultiple: print(f'[stdout] {url} {stdout.decode()}') if stderr: - output = open(local_filename + log_sep + domain + '.stderr', 'w') + output = open(logdir + domain + '.stderr', 'w') output.write(stderr.decode()) output.close() if self.debug: print(f'[stderr] {url} {stderr.decode()}') - output = open(local_filename + log_sep + domain + '.returncode', 'w') + output = open(logdir + domain + '.returncode', 'w') output.write(str(proc.returncode) + '\n') output.close() - output = open(local_filename + log_sep + domain + '.date', 'w') + output = open(logdir + domain + '.date', 'w') output.write(str(datetime.datetime.now()) + '\n') output.close() -- cgit v1.2.3