aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xckandumper26
1 files changed, 21 insertions, 5 deletions
diff --git a/ckandumper b/ckandumper
index c93e071..189459f 100755
--- a/ckandumper
+++ b/ckandumper
@@ -30,7 +30,7 @@ class DownloadMultiple:
def __init__(self, limit_rate, limit_concurrent = 20, progress = True, debug = False, wget = '/usr/bin/wget'):
if not os.path.exists(wget):
- raise FileNotFoundError('Wget not found in your path; please install it first.')
+ raise FileNotFoundError('Wget not found in path ' + wget + '; please install it first.')
self.limit_rate = limit_rate
self.limit_concurrent = asyncio.Semaphore(int(limit_concurrent))
@@ -59,8 +59,8 @@ class DownloadMultiple:
self.ensuredir(os.path.dirname(local_filename));
- # Other opts: -q --show-progress
- cmd = self.wget + ' ' + self.limit_rate + ' -q --show-progress --progress=dot -c -O "' + local_filename + '" ' + url
+ # Other opts: -q --show-progress -O
+ cmd = self.wget + ' ' + self.limit_rate + ' -c -O "' + local_filename + '" ' + url
proc = await asyncio.create_subprocess_shell(cmd,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
@@ -68,13 +68,25 @@ class DownloadMultiple:
stdout, stderr = await proc.communicate()
if stdout:
+ output = open(local_filename + '.stdout', 'w')
+ output.write(stdout.decode())
+ output.close()
+
if self.debug:
print(f'[stdout] {url} {stdout.decode()}')
if stderr:
+ output = open(local_filename + '.stderr', 'w')
+ output.write(stderr.decode())
+ output.close()
+
if self.debug:
print(f'[stderr] {url} {stderr.decode()}')
+ output = open(local_filename + '.returncode', 'w')
+ output.write(str(proc.returncode))
+ output.close()
+
if self.debug:
print(f'[{cmd!r} exited with {proc.returncode}]')
@@ -258,5 +270,9 @@ if __name__ == "__main__":
args = parser.parse_args()
# Dispatch
- ckan = CkanDumper(args)
- ckan.dump()
+ try:
+ ckan = CkanDumper(args)
+ ckan.dump()
+ except FileNotFoundError as e:
+ print(e)
+ exit(1)