Python SDK Getting Started

First Case:

-------------------------------------------------------------------------------
My Local Machine:

OS Name:                   Microsoft Windows Server 2012 Datacenter
OS Version:                6.2.9200 N/A Build 9200
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Server


Using:
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit 

-------------------------------------------------------------------------------

Running the example code from:

When i run python3 couch-py.py (the code from above link)
From my localhost using…

cluster = Cluster(‘couchbase://localhost’, ClusterOptions(
PasswordAuthenticator(‘Administrator’, ‘password’)))

I get the following:

Upsert CAS:
<Key=‘airline_8091’, RC=0x407[LCB_ERR_KVENGINE_INVALID_PACKET (1031)], Operational Error, Results=1, C Source=(src/multiresult.c,332), Context={‘status_code’: 4, ‘opaque’: 0, ‘cas’: 0, ‘key’: ‘airline_8091’, ‘bucket’: ‘travel-sample’, ‘collection’: ‘airline’, ‘scope’: ‘inventory’, ‘context’: ‘Request must include key’, ‘ref’: ‘’, ‘endpoint’: ‘localhost:11210’, ‘type’: ‘KVErrorContext’}, Tracing Output={“airline_8091”: {“debug_info”: {“FILE”: “src/callbacks.c”, “FUNC”: “dur_chain2”, “LINE”: 743}}}>

Get Result:
<Key=‘airline_8091’, RC=0x407[LCB_ERR_KVENGINE_INVALID_PACKET (1031)], Operational Error, Results=1, C Source=(src/multiresult.c,332), Context={‘status_code’: 4, ‘opaque’: 1, ‘cas’: 0, ‘key’: ‘airline_8091’, ‘bucket’: ‘travel-sample’, ‘collection’: ‘airline’, ‘scope’: ‘inventory’, ‘context’: ‘Request must include key’, ‘ref’: ‘’, ‘endpoint’: ‘localhost:11210’, ‘type’: ‘KVErrorContext’}, Tracing Output={“airline_8091”: {“debug_info”: {“FILE”: “src/callbacks.c”, “FUNC”: “value_callback”, “LINE”: 848}}}>

Lookup Result:
<RC=0x191[LCB_ERR_PLANNING_FAILURE (401)], HTTP Request failed. Examine ‘objextra’ for full result, Results=1, C Source=(src/pycbc_http.c,203), OBJ=ViewResult<rc=0x191[LCB_ERR_PLANNING_FAILURE (401)], value={‘requestID’: ‘833b0154-d803-4f9a-bc81-95044421de85’, ‘clientContextID’: ‘c308bb5c9fcc1f65’, ‘errors’: [{‘code’: 4000, ‘msg’: ‘No index available on keyspace default:travel-sample.inventory.airline that matches your query. Use CREATE PRIMARY INDEX ON default:travel-sample.inventory.airline to create a primary index, or check that your expected index is online.’}], ‘status’: ‘fatal’}, http_status=0, tracing_context=0, tracing_output=None>, Context={‘first_error_code’: 4000, ‘http_response_code’: 404, ‘first_error_message’: ‘No index available on keyspace default:travel-sample.inventory.airline that matches your query. Use CREATE PRIMARY INDEX ON default:travel-sample.inventory.airline to create a primary index, or check that your expected index is online.’, ‘statement’: ‘SELECT VALUE name FROM travel-sample.inventory.airline WHERE callsign = $1’, ‘client_context_id’: ‘c308bb5c9fcc1f65’, ‘query_params’: ‘’, ‘http_response_body’: ‘’, ‘endpoint’: ‘localhost:8093’, ‘type’: ‘QueryErrorContext’}, Tracing Output={“:nokey:0”: null}>

The results you should expect should be follows:

Upsert CAS:
1598469741559152640

Get Result:
{‘type’: ‘airline’, ‘id’: 8091, ‘callsign’: ‘CBS’, ‘iata’: None, ‘icao’: None, ‘name’: ‘Couchbase Airways’}

Lookup Result:
Couchbase Airways

Second Case:

-------------------------------------------------------------------------------
Outside Machine

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19043 N/A Build 19043
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation


Using:
Python 3.7.8 (tags/v3.7.8:4b47a5b6ba, Jun 28 2020, 08:53:46) [MSC v.1916 64 bit (AMD64)]
-------------------------------------------------------------------------------

When i run python3 couch-py.py (same code from above link) from an outside machine

cluster = Cluster(‘couchbase://52.133.163.121’, ClusterOptions(
PasswordAuthenticator(‘Administrator’, ‘password’)))

I get the following results:

Traceback (most recent call last):
File “C:\Users\blitz\Projects\Python\Couchbase\couch-py.py”, line 12, in
PasswordAuthenticator(‘Administrator’, ‘password’)))
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\cluster.py”, line 573, in init
**self._clusteropts
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\client.py”, line 160, in init
self._do_ctor_connect()
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\cluster.py”, line 597, in _do_ctor_connect
super(Cluster, self)._do_ctor_connect(*args, **kwargs)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\client.py”, line 169, in _do_ctor_connect
self._connect()
couchbase.exceptions.TimeoutException: <RC=0xC9[LCB_ERR_TIMEOUT (201)], There was a problem while trying to send/receive your request over the network. This may be a result of a bad network or a misconfigured client or server, C Source=(src/bucket.c,1229)>

What am I doing wrong? How do I connect from outside machine using python? (Is there a working example, like a getting started or a tutorial for python connectivity…?

@davy.rony Have you checked for firewall possibly blocking port(s) Couchbase uses?

No, not a firewall issue. I did eventually find some examples on the couchlabs git page here:

https://github.com/couchbaselabs/try-cb-python/

And I can connect with it with no problem.

1 Like

Running the try-cb-python
from the link above with the swagger ip/apidocs gives me the following error

I did install all the requirements . What am i missing?

couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)> // Werkzeug Debugger

couchbase.exceptions.NotSupportedException

couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>

Traceback (most recent call last)

  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in __call__

     
        def __call__(self, environ, start_response):
            """The WSGI server calls the Flask application object as the
            WSGI application. This calls :meth:`wsgi_app` which can be
            wrapped to applying middleware."""
            return self.wsgi_app(environ, start_response)
     
        def __repr__(self):
            return "<%s %r>" % (self.__class__.__name__, self.name)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app

                try:
                    ctx.push()
                    response = self.full_dispatch_request()
                except Exception as e:
                    error = e
                    response = self.handle_exception(e)
                except:  # noqa: B001
                    error = sys.exc_info()[1]
                    raise
                return response(environ, start_response)
            finally:
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function

            # Wrap exception handlers with cross_origin
            # These error handlers will still respect the behavior of the route
            if options.get('intercept_exceptions', True):
                def _after_request_decorator(f):
                    def wrapped_function(*args, **kwargs):
                        return cors_after_request(app.make_response(f(*args, **kwargs)))
                    return wrapped_function
     
                if hasattr(app, 'handle_exception'):
                    app.handle_exception = _after_request_decorator(
                        app.handle_exception)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception

                # if we want to repropagate the exception, we can attempt to
                # raise it with the whole traceback in case we can do that
                # (the function was actually called from the except part)
                # otherwise, we just raise the error again
                if exc_value is e:
                    reraise(exc_type, exc_value, tb)
                else:
                    raise e
     
            self.log_exception((exc_type, exc_value, tb))
            server_error = InternalServerError()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise

        import collections.abc as collections_abc
     
        def reraise(tp, value, tb=None):
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
            raise value
     
        implements_to_string = _identity
     
    else:
        iterkeys = lambda d: d.iterkeys()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app

            ctx = self.request_context(environ)
            error = None
            try:
                try:
                    ctx.push()
                    response = self.full_dispatch_request()
                except Exception as e:
                    error = e
                    response = self.handle_exception(e)
                except:  # noqa: B001
                    error = sys.exc_info()[1]
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request

                request_started.send(self)
                rv = self.preprocess_request()
                if rv is None:
                    rv = self.dispatch_request()
            except Exception as e:
                rv = self.handle_user_exception(e)
            return self.finalize_request(rv)
     
        def finalize_request(self, rv, from_error_handler=False):
            """Given the return value from a view function this finalizes
            the request by converting it into a response and invoking the
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function

            # Wrap exception handlers with cross_origin
            # These error handlers will still respect the behavior of the route
            if options.get('intercept_exceptions', True):
                def _after_request_decorator(f):
                    def wrapped_function(*args, **kwargs):
                        return cors_after_request(app.make_response(f(*args, **kwargs)))
                    return wrapped_function
     
                if hasattr(app, 'handle_exception'):
                    app.handle_exception = _after_request_decorator(
                        app.handle_exception)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception

                return self.handle_http_exception(e)
     
            handler = self._find_error_handler(e)
     
            if handler is None:
                reraise(exc_type, exc_value, tb)
            return handler(e)
     
        def handle_exception(self, e):
            """Handle an exception that did not have an error handler
            associated with it, or that was raised from an error handler.
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise

        import collections.abc as collections_abc
     
        def reraise(tp, value, tb=None):
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
            raise value
     
        implements_to_string = _identity
     
    else:
        iterkeys = lambda d: d.iterkeys()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request

            self.try_trigger_before_first_request_functions()
            try:
                request_started.send(self)
                rv = self.preprocess_request()
                if rv is None:
                    rv = self.dispatch_request()
            except Exception as e:
                rv = self.handle_user_exception(e)
            return self.finalize_request(rv)
     
        def finalize_request(self, rv, from_error_handler=False):
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request

                getattr(rule, "provide_automatic_options", False)
                and req.method == "OPTIONS"
            ):
                return self.make_default_options_response()
            # otherwise dispatch to the handler for that endpoint
            return self.view_functions[rule.endpoint](**req.view_args)
     
        def full_dispatch_request(self):
            """Dispatches the request and on top of that performs request
            pre and postprocessing as well as HTTP exception catching and
            error handling.
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\decorator.py", line 128, in wrapped_function

                options = get_cors_options(current_app, _options)
     
                if options.get('automatic_options') and request.method == 'OPTIONS':
                    resp = current_app.make_default_options_response()
                else:
                    resp = make_response(f(*args, **kwargs))
     
                set_cors_headers(resp, options)
                setattr(resp, FLASK_CORS_EVALUATED, True)
                return resp
     
  • File "C:\Users\blitz\Projects\Python\Couchbase\try-cb-python\travel.py", line 710, in hotels

            scope = bucket.scope('inventory')
            hotel_collection = scope.collection('hotel')
            q = cluster.search_query('hotels-index', qp, SearchOptions(limit=100))
            results = []
            cols = ['address', 'city', 'state', 'country', 'name', 'description']
            for row in q:
                subdoc = hotel_collection.lookup_in(
                    row.id, tuple(SD.get(x) for x in cols))
                # Get the address fields from the document, if they exist
                addr = ', '.join(subdoc.content_as[str](c) for c in cols[:4]
                                 if subdoc.content_as[str](c) != "None")
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\__init__.py", line 281, in __iter__

            for row in self.buffered_rows:
                yield row
            parent_iter = self.basecls.__iter__(self)
            while not self.done:
                try:
                    next_item = next(parent_iter)
                    self.buffered_rows.append(next_item)
                    yield next_item
                except (StopAsyncIteration, StopIteration) as e:
                    self.done = True
                    break
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1322, in __iter__

     
        def __iter__(self):
            if not self._do_iter:
                raise AlreadyQueriedException()
     
            self._start()
            while self._do_iter:
                raw_rows = self.raw.fetch(self._mres)
                actual_rows = list(raw_rows)
                for row in self._process_payload(actual_rows):
                    yield row
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1221, in _start

        def _start(self):
            if self._mres:
                return
     
            self._mres = self._parent._fts_query(
                self._body, span=self._span, index=self._index)
            self.__raw = self._mres[None]
     
        @property
        def raw(self):
            return self.__raw
couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>

This is the Copy/Paste friendly version of the traceback. You can also paste this traceback into a gist:

Traceback (most recent call last): File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise raise value File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise raise value File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\decorator.py", line 128, in wrapped_function resp = make_response(f(*args, **kwargs)) File "C:\Users\blitz\Projects\Python\Couchbase\try-cb-python\travel.py", line 710, in hotels for row in q: File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\__init__.py", line 281, in __iter__ next_item = next(parent_iter) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1322, in __iter__ self._start() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1221, in _start self._body, span=self._span, index=self._index) couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. If you enable JavaScript you can also use additional features such as code execution (if the evalex feature is enabled), automatic pasting of the exceptions and much more.
Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.
<div class="pin-prompt">
  <div class="inner">
    <h3>Console Locked</h3>
    <p>
      The console is locked and needs to be unlocked by entering the PIN.
      You can find the PIN printed out on the standard output of your
      shell that runs the server.
    <form>
      <p>PIN:
        <input type=text name=pin size=14>
        <input type=submit name=btn value="Confirm Pin">
    </form>
  </div>
</div>

Response headers

swagger gives me this response to requests:
I have installed all the requirements.txt

500
Undocumented
Error: INTERNAL SERVER ERROR
Response body
Download

couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)> // Werkzeug Debugger

couchbase.exceptions.NotSupportedException

couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>

Traceback (most recent call last)

  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in __call__

     
        def __call__(self, environ, start_response):
            """The WSGI server calls the Flask application object as the
            WSGI application. This calls :meth:`wsgi_app` which can be
            wrapped to applying middleware."""
            return self.wsgi_app(environ, start_response)
     
        def __repr__(self):
            return "<%s %r>" % (self.__class__.__name__, self.name)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app

                try:
                    ctx.push()
                    response = self.full_dispatch_request()
                except Exception as e:
                    error = e
                    response = self.handle_exception(e)
                except:  # noqa: B001
                    error = sys.exc_info()[1]
                    raise
                return response(environ, start_response)
            finally:
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function

            # Wrap exception handlers with cross_origin
            # These error handlers will still respect the behavior of the route
            if options.get('intercept_exceptions', True):
                def _after_request_decorator(f):
                    def wrapped_function(*args, **kwargs):
                        return cors_after_request(app.make_response(f(*args, **kwargs)))
                    return wrapped_function
     
                if hasattr(app, 'handle_exception'):
                    app.handle_exception = _after_request_decorator(
                        app.handle_exception)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception

                # if we want to repropagate the exception, we can attempt to
                # raise it with the whole traceback in case we can do that
                # (the function was actually called from the except part)
                # otherwise, we just raise the error again
                if exc_value is e:
                    reraise(exc_type, exc_value, tb)
                else:
                    raise e
     
            self.log_exception((exc_type, exc_value, tb))
            server_error = InternalServerError()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise

        import collections.abc as collections_abc
     
        def reraise(tp, value, tb=None):
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
            raise value
     
        implements_to_string = _identity
     
    else:
        iterkeys = lambda d: d.iterkeys()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app

            ctx = self.request_context(environ)
            error = None
            try:
                try:
                    ctx.push()
                    response = self.full_dispatch_request()
                except Exception as e:
                    error = e
                    response = self.handle_exception(e)
                except:  # noqa: B001
                    error = sys.exc_info()[1]
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request

                request_started.send(self)
                rv = self.preprocess_request()
                if rv is None:
                    rv = self.dispatch_request()
            except Exception as e:
                rv = self.handle_user_exception(e)
            return self.finalize_request(rv)
     
        def finalize_request(self, rv, from_error_handler=False):
            """Given the return value from a view function this finalizes
            the request by converting it into a response and invoking the
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function

            # Wrap exception handlers with cross_origin
            # These error handlers will still respect the behavior of the route
            if options.get('intercept_exceptions', True):
                def _after_request_decorator(f):
                    def wrapped_function(*args, **kwargs):
                        return cors_after_request(app.make_response(f(*args, **kwargs)))
                    return wrapped_function
     
                if hasattr(app, 'handle_exception'):
                    app.handle_exception = _after_request_decorator(
                        app.handle_exception)
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception

                return self.handle_http_exception(e)
     
            handler = self._find_error_handler(e)
     
            if handler is None:
                reraise(exc_type, exc_value, tb)
            return handler(e)
     
        def handle_exception(self, e):
            """Handle an exception that did not have an error handler
            associated with it, or that was raised from an error handler.
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise

        import collections.abc as collections_abc
     
        def reraise(tp, value, tb=None):
            if value.__traceback__ is not tb:
                raise value.with_traceback(tb)
            raise value
     
        implements_to_string = _identity
     
    else:
        iterkeys = lambda d: d.iterkeys()
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request

            self.try_trigger_before_first_request_functions()
            try:
                request_started.send(self)
                rv = self.preprocess_request()
                if rv is None:
                    rv = self.dispatch_request()
            except Exception as e:
                rv = self.handle_user_exception(e)
            return self.finalize_request(rv)
     
        def finalize_request(self, rv, from_error_handler=False):
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request

                getattr(rule, "provide_automatic_options", False)
                and req.method == "OPTIONS"
            ):
                return self.make_default_options_response()
            # otherwise dispatch to the handler for that endpoint
            return self.view_functions[rule.endpoint](**req.view_args)
     
        def full_dispatch_request(self):
            """Dispatches the request and on top of that performs request
            pre and postprocessing as well as HTTP exception catching and
            error handling.
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\decorator.py", line 128, in wrapped_function

                options = get_cors_options(current_app, _options)
     
                if options.get('automatic_options') and request.method == 'OPTIONS':
                    resp = current_app.make_default_options_response()
                else:
                    resp = make_response(f(*args, **kwargs))
     
                set_cors_headers(resp, options)
                setattr(resp, FLASK_CORS_EVALUATED, True)
                return resp
     
  • File "C:\Users\blitz\Projects\Python\Couchbase\try-cb-python\travel.py", line 710, in hotels

            scope = bucket.scope('inventory')
            hotel_collection = scope.collection('hotel')
            q = cluster.search_query('hotels-index', qp, SearchOptions(limit=100))
            results = []
            cols = ['address', 'city', 'state', 'country', 'name', 'description']
            for row in q:
                subdoc = hotel_collection.lookup_in(
                    row.id, tuple(SD.get(x) for x in cols))
                # Get the address fields from the document, if they exist
                addr = ', '.join(subdoc.content_as[str](c) for c in cols[:4]
                                 if subdoc.content_as[str](c) != "None")
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\__init__.py", line 281, in __iter__

            for row in self.buffered_rows:
                yield row
            parent_iter = self.basecls.__iter__(self)
            while not self.done:
                try:
                    next_item = next(parent_iter)
                    self.buffered_rows.append(next_item)
                    yield next_item
                except (StopAsyncIteration, StopIteration) as e:
                    self.done = True
                    break
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1322, in __iter__

     
        def __iter__(self):
            if not self._do_iter:
                raise AlreadyQueriedException()
     
            self._start()
            while self._do_iter:
                raw_rows = self.raw.fetch(self._mres)
                actual_rows = list(raw_rows)
                for row in self._process_payload(actual_rows):
                    yield row
  • File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1221, in _start

        def _start(self):
            if self._mres:
                return
     
            self._mres = self._parent._fts_query(
                self._body, span=self._span, index=self._index)
            self.__raw = self._mres[None]
     
        @property
        def raw(self):
            return self.__raw
couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>

This is the Copy/Paste friendly version of the traceback. You can also paste this traceback into a gist:

Traceback (most recent call last): File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2464, in __call__ return self.wsgi_app(environ, start_response) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2450, in wsgi_app response = self.handle_exception(e) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1867, in handle_exception reraise(exc_type, exc_value, tb) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise raise value File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 2447, in wsgi_app response = self.full_dispatch_request() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1952, in full_dispatch_request rv = self.handle_user_exception(e) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1821, in handle_user_exception reraise(exc_type, exc_value, tb) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\_compat.py", line 39, in reraise raise value File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1950, in full_dispatch_request rv = self.dispatch_request() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py", line 1936, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\decorator.py", line 128, in wrapped_function resp = make_response(f(*args, **kwargs)) File "C:\Users\blitz\Projects\Python\Couchbase\try-cb-python\travel.py", line 710, in hotels for row in q: File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core\__init__.py", line 281, in __iter__ next_item = next(parent_iter) File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1322, in __iter__ self._start() File "C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py", line 1221, in _start self._body, span=self._span, index=self._index) couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn't schedule fts query, C Source=(src/fts.c,163)>

Traceback (most recent call last):
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 2464, in call
return self.wsgi_app(environ, start_response)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 2450, in wsgi_app
response = self.handle_exception(e)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py”, line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_compat.py”, line 39, in reraise
raise value
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 2447, in wsgi_app
response = self.full_dispatch_request()
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\extension.py”, line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_compat.py”, line 39, in reraise
raise value
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 1950, in full_dispatch_request
rv = self.dispatch_request()
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask\app.py”, line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\flask_cors\decorator.py”, line 128, in wrapped_function
resp = make_response(f(*args, **kwargs))
File “C:\Users\blitz\Projects\Python\Couchbase\try-cb-python\travel.py”, line 710, in hotels
for row in q:
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase_core_init_.py”, line 281, in iter
next_item = next(parent_iter)
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py”, line 1322, in iter
self._start()
File “C:\Users\blitz\AppData\Roaming\Python\Python37\site-packages\couchbase\search.py”, line 1221, in _start
self._body, span=self._span, index=self._index)
couchbase.exceptions.NotSupportedException: <RC=0xD6[LCB_ERR_UNSUPPORTED_OPERATION (214)], Couldn’t schedule fts query, C Source=(src/fts.c,163)>

→

this one appears constantly no matter what machine i use , local remote azure msys2 etc…

Requirement already satisfied: couchbase==3.2.2 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 1)) (3.2.2)
Requirement already satisfied: DateTime==4.1.1 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 2)) (4.1.1)
Requirement already satisfied: Flask==1.1.2 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 3)) (1.1.2)
Requirement already satisfied: Flask-Classy==0.6.10 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 4)) (0.6.10)
Requirement already satisfied: itsdangerous==0.24 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 5)) (0.24)
Requirement already satisfied: Jinja2==2.11.3 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 6)) (2.11.3)
Requirement already satisfied: MarkupSafe==0.23 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 7)) (0.23)
Requirement already satisfied: PyJWT==1.4.2 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 8)) (1.4.2)
Requirement already satisfied: pytz==2016.10 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 9)) (2016.10)
Requirement already satisfied: six>=1.10.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 10)) (1.15.0)
Requirement already satisfied: Werkzeug==1.0.1 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 11)) (1.0.1)
Requirement already satisfied: zope.interface>=5.2.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 12)) (5.4.0)
Requirement already satisfied: Flask-Cors>=3.0.10 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 13)) (3.0.10)
Requirement already satisfied: flasgger==0.9.5 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from -r requirements.txt (line 14)) (0.9.5)
Requirement already satisfied: wrapt>=1.11.2 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from couchbase==3.2.2->-r requirements.txt (line 1)) (1.13.3)
Requirement already satisfied: mypy-extensions in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from couchbase==3.2.2->-r requirements.txt (line 1)) (0.4.3)
Requirement already satisfied: durationpy==0.5 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from couchbase==3.2.2->-r requirements.txt (line 1)) (0.5)
Requirement already satisfied: pyrsistent>=0.15.2 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from couchbase==3.2.2->-r requirements.txt (line 1)) (0.18.0)
Requirement already satisfied: attrs>=19.1.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from couchbase==3.2.2->-r requirements.txt (line 1)) (21.2.0)
Requirement already satisfied: click>=5.1 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from Flask==1.1.2->-r requirements.txt (line 3)) (8.0.3)
Requirement already satisfied: jsonschema>=3.0.1 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from flasgger==0.9.5->-r requirements.txt (line 14)) (4.2.1)
Requirement already satisfied: PyYAML>=3.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from flasgger==0.9.5->-r requirements.txt (line 14)) (6.0)
Requirement already satisfied: mistune in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from flasgger==0.9.5->-r requirements.txt (line 14)) (0.8.4)
Requirement already satisfied: setuptools in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from zope.interface>=5.2.0->-r requirements.txt (line 12)) (56.0.0)
Requirement already satisfied: colorama in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from click>=5.1->Flask==1.1.2->-r requirements.txt (line 3)) (0.4.4)
Requirement already satisfied: importlib-resources>=1.4.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from jsonschema>=3.0.1->flasgger==0.9.5->-r requirements.txt (line 14)) (5.4.0)
Requirement already satisfied: zipp>=3.1.0 in c:\users\blitz\appdata\local\programs\python\python38\lib\site-packages (from importlib-resources>=1.4.0->jsonschema>=3.0.1->flasgger==0.9.5->-r requirements.txt (line 14)) (3.6.0)

C:\Users\blitz\Desktop\try-cb-python>python travel.py -c localhost -u Admin
istrator password
Traceback (most recent call last):
File “travel.py”, line 7, in
import couchbase.search as FT
**> ModuleNotFoundError: No module named 'couchbase'**

A quick search shows that’s a generic error. Perhaps your cluster doesn’t have the FTS service enabled? I might recommend you simplify what you’re trying to do and turn up the log level to verify.

@Maria_Shodunke or @hakim.cassimally may be able to help further.

Yes, looks like this is thrown when you attempt an operation that your cluster doesn’t have nodes to support.

Can you access the management panel for the Couchbase server? If so, then check the list of nodes, and make sure that one of them is running the Search service.

(As you said the database is external, it’s possible that you don’t have access? In which case, please could you check that with whoever is managing the cluster?)