When running the clear command, if a dataset name is given which does not correspond do a real dataset the result from the decoded request will be the string '"\'NoneType\' object has no attribute \'datasets\'"'. As a result the if statement on the last line below will yield the error TypeError: string indices must be integers, not 'str' and the command with error out.
payload = {"name": dataset, "scope": scope}
url = server + "/query/dataset/find"
logger.debug(f"URL: {url}")
try:
r = requests.post(url, json=payload)
dataset_locations = utilities.decode_response(r) # type: ignore
except ConnectionError:
return "The Datatrail Central Server at CHIME at is not reachable!!!"
# Build data paths.
if dataset_locations["file_replica_locations"].get("minoc"): # type: ignore
Suggest adding a check like this from similar function
if "object has no attribute" in policy_response and isinstance(
files_response, str
):
raise Exception(f"Could not find {dataset} {scope} in Datatrail.")
@tjzegmott unless this error is caught some other way I'm not aware of? If not I'll make the requisite changes.
When running the clear command, if a dataset name is given which does not correspond do a real dataset the result from the decoded request will be the string
'"\'NoneType\' object has no attribute \'datasets\'"'
. As a result the if statement on the last line below will yield the errorTypeError: string indices must be integers, not 'str'
and the command with error out.Suggest adding a check like this from similar function
@tjzegmott unless this error is caught some other way I'm not aware of? If not I'll make the requisite changes.