We currently receive the following traceback when trying to print that error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/couchbase/result.py", line 140, in _parse_content_at_index
raise PathNotFoundException(
couchbase.exceptions.PathNotFoundException: <unprintable PathNotFoundException object>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "__main__", line 10, in __main__
print(str(why))
File "/usr/local/lib/python3.10/site-packages/couchbase/exceptions.py", line 389, in __str__
self._base.err(),
AttributeError: 'str' object has no attribute 'err'
Environment:
- Server side:
- CouchBase 6.6.5, official image
- Client side:
- Linux Alpine 3.17
- Python 3.10.10
- Python SDK 4.1.3, built from source
Minimal code example:
cluster = Cluster(COUCHBASE_URI, ClusterOptions(
PasswordAuthenticator(COUCHBASE_USER, COUCHBASE_PASS),
# New client tries to fetch DNS SRV record when supplied with just one host
enable_dns_srv=False,
))
col = cluster.bucket(COUCHBASE_BUCKET).default_collection()
col.insert("key", {"attr": "value"})
res = col.lookup_in("key", [subdocument.get("notexist")]
try:
val = res.content_as[str](0)
except PathNotFoundException as why:
print(str(why)) # this raises an exception
A problem is that the CouchbaseException __init__
method signature changed in Python client 4.x, but some client code still raises exceptions as raise PathNotFoundException("message")
, while the first positional argument must not be a string.