diff --git a/totalsegmentator/config.py b/totalsegmentator/config.py index d9a491648..dbb2f8522 100644 --- a/totalsegmentator/config.py +++ b/totalsegmentator/config.py @@ -75,7 +75,7 @@ def setup_totalseg(totalseg_id=None): def set_license_number(license_number): if not is_valid_license(license_number): print("ERROR: Invalid license number. Please check your license number or contact support.") - sys.exit(0) + sys.exit(1) totalseg_dir = get_totalseg_dir() totalseg_config_file = totalseg_dir / "config.json" @@ -106,7 +106,7 @@ def is_valid_license(license_number): try: url = f"http://backend.totalsegmentator.com:80/" r = requests.post(url + "is_valid_license_number", - json={"license_number": license_number}, timeout=2) + json={"license_number": license_number}, timeout=5) if r.ok: return r.json()['status'] == "valid_license" else: @@ -226,7 +226,7 @@ def send_usage_stats(config, params): "python_version": sys.version, "cuda_available": torch.cuda.is_available(), "license_number": license_number - }, timeout=2) + }, timeout=5) # if r.ok: # print(f"status: {r.json()['status']}") # else: diff --git a/totalsegmentator/libs.py b/totalsegmentator/libs.py index bbf99f29d..53380fa07 100644 --- a/totalsegmentator/libs.py +++ b/totalsegmentator/libs.py @@ -80,7 +80,7 @@ def download_model_with_license_and_unpack(task_name, config_dir): else: if r.json()['status'] == "invalid_license": print(f"ERROR: Invalid license number ({license_number}). Please check your license number or contact support.") - sys.exit(0) + sys.exit(1) except Exception as e: raise e diff --git a/totalsegmentator/python_api.py b/totalsegmentator/python_api.py index faf9f7528..40c98e4ae 100644 --- a/totalsegmentator/python_api.py +++ b/totalsegmentator/python_api.py @@ -29,13 +29,13 @@ def show_license_info(): For commercial usage contact: jakob.wasserthal@usb.ch """)) - sys.exit(0) + sys.exit(1) elif status == "invalid_license": print(message) - sys.exit(0) + sys.exit(1) elif status == "missing_config_file": print(message) - sys.exit(0) + sys.exit(1) def totalsegmentator(input, output, ml=False, nr_thr_resamp=1, nr_thr_saving=6,