Skip to content

Commit

Permalink
paquo get_quath: better error
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Feb 21, 2024
1 parent 27cb6ff commit f4b3f82
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions paquo/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,16 @@ def _download_cb(it, name):
finally:
print("")

file = download_qupath(
args.version,
path=args.download_path,
callback=_download_cb,
system=system,
ssl_verify=not args.no_ssl_verify
)
try:
file = download_qupath(
args.version,
path=args.download_path,
callback=_download_cb,
system=system,
ssl_verify=not args.no_ssl_verify
)
except Exception:
raise SystemExit(1)
print("# extracting:", file)
app = extract_qupath(file, args.install_path, system=system)
print("# available at:", app)
Expand Down
2 changes: 1 addition & 1 deletion paquo/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ def download_qupath(
_ctx.verify_mode = ssl.CERT_NONE

try:
print("# requesting:", url)
with open(out_fn, mode="wb") as tmp, urlopen(url, context=_ctx) as f: # nosec B310
for chunk in callback(iter(lambda: f.read(chunk_size), b""), name=url):
tmp.write(chunk)
except Exception:
print("# error requesting:", url, file=sys.stderr)
try:
os.unlink(out_fn)
except OSError:
Expand Down

0 comments on commit f4b3f82

Please sign in to comment.