Skip to content
Community forum

org.crud.get() returns None instead of raising

SolvedSupero SupportSupero team asked

Common question, written up by the Supero team.

Error message
TypeError: 'NoneType' object is not subscriptable

We expected an exception for a missing record, so the except never runs and the next line fails:

python
try:
    task = org.crud.get("task", task_uuid)
except Exception:
    task = None
print(task["title"])
Link

1 answer

Accepted answer
Accepted answer

Not-found isn't an exception in the Python SDK. org.crud.get() returns None on a 404 and org.crud.delete() returns False. Check the return value:

python
task = org.crud.get("task", task_uuid)
if task is None:
    ...

A record that exists but belongs to a tenant or owner you can't see also comes back as 404, so None can mean "not visible to this credential" as well as "doesn't exist".

Supero DX teamSupero team answered
Link

Your answer

org.crud.get() returns None instead of raising | Supero Community