Hi,
The following lines are within my script:
deadline=datetime.now()+timedelta(seconds=180)
while True:
try:
cluster.query_indexes().create_index(Here comes the index)
break
except TimeoutException:
if datetime.now()>=deadline:
raise
time.sleep(5) # don’t hammer the server too hard
However, while running the script I get:
Traceback (most recent call last):
File “”, line 3, in
File “/opt/python38/lib/python3.8/site-packages/couchbase/exceptions.py”, line 1411, in wrapped
return func(*args, **kwargs)
File “/opt/python38/lib/python3.8/site-packages/couchbase/management/queries.py”, line 149, in create_index
self._create_index(bucket_name, fields, index_name, *options, **kwargs)
File “/opt/python38/lib/python3.8/site-packages/couchbase/management/queries.py”, line 156, in _create_index
self._n1ql_index_create(bucket_name, index_name, fields=fields, **final_args)
File “/opt/python38/lib/python3.8/site-packages/couchbase/management/queries.py”, line 125, in _n1ql_index_create
return IxmgmtRequest(self._admin_bucket, ‘create’, info, **options).execute()
File “/opt/python38/lib/python3.8/site-packages/couchbase_core/_ixmgmt.py”, line 160, in execute
return [x for x in self]
File “/opt/python38/lib/python3.8/site-packages/couchbase_core/_ixmgmt.py”, line 160, in
return [x for x in self]
File “/opt/python38/lib/python3.8/site-packages/couchbase_core/_ixmgmt.py”, line 147, in iter
raw_rows = self.__raw.fetch(self._mres)
couchbase.exceptions.TimeoutException: <RC=0xC9[LCB_ERR_TIMEOUT (201)], HTTP Request failed. Examine ‘objextra’ for full result, Results=1, C Source=(src/pycbc_http.c,212), OBJ=ViewResult<rc=0xC9[LCB_ERR_TIMEOUT (201)], value=None, http_status=201, tracing_context=0, tracing_output=None>, Tracing Output={":nokey:0": null}>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “”, line 5, in
NameError: name ‘TimeoutException’ is not defined
How can I make sure not getting the “NameError: name ‘TimeoutException’ is not defined”?
Thanks