Description
In trustgraph-cli/trustgraph/cli/load_sample_documents.py (lines 31–34):
try:
os.mkdir("doc-cache")
except:
pass
Problem
The intent is to ignore "directory already exists", but bare except: also silently swallows permission errors, read-only filesystem errors, and any other OS-level failure. The user gets no feedback when the cache directory can't be created, and the script fails later with a confusing error when it tries to write into the missing directory.
Suggested fix
Please PR against the latest release/vX.Y branch.
os.makedirs("doc-cache", exist_ok=True)
This is a one-line fix. os.makedirs with exist_ok=True handles the "already exists" case and lets real errors (permissions, disk full) propagate naturally.
What you'll learn
How the CLI sample-document loader works, and the difference between os.mkdir and os.makedirs.
Description
In
trustgraph-cli/trustgraph/cli/load_sample_documents.py(lines 31–34):Problem
The intent is to ignore "directory already exists", but bare
except:also silently swallows permission errors, read-only filesystem errors, and any other OS-level failure. The user gets no feedback when the cache directory can't be created, and the script fails later with a confusing error when it tries to write into the missing directory.Suggested fix
Please PR against the latest
release/vX.Ybranch.This is a one-line fix.
os.makedirswithexist_ok=Truehandles the "already exists" case and lets real errors (permissions, disk full) propagate naturally.What you'll learn
How the CLI sample-document loader works, and the difference between
os.mkdirandos.makedirs.