Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4775

Python3.9 pymongo-4.9.1 throws error cannot import name '_QUERY_OPTIONS' from 'pymongo.cursor' (python3.9/site-packages/pymongo/cursor.py)

    • Type: Icon: Question Question
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Detailed steps to reproduce the problem?

      Include full traceback, if possible
      Exception has occurred: ImportError
      cannot import name '_QUERY_OPTIONS' from 'pymongo.cursor' (/lib/python3.9/site-packages/pymongo/cursor.py)
      File "lambda_layer/helperlayer/helperlayer/tripmodels.py", line 1, in <module>
      fromodmanticimportField, Model, EmbeddedModel
      File "lambda_layer/helperlayer/helperlayer/_init_.py", line 7, in <module>
      from helperlayer.tripmodels import *
      File "/flightconsolidator/connectors/mongo_connector.py", line 1, in <module>
      from helperlayer import PyMongoConnection, LegEvent, Recommendation
      File "/flightconsolidator/analytics.py", line 1, in <module>
      from connectors.mongo_connector import mongo_obj
      File "/flightconsolidator/app.py", line 6, in <module>
      from analytics import flight_profiling
      ImportError: cannot import name '_QUERY_OPTIONS' from 'pymongo.cursor' (/lib/python3.9/site-packages/pymongo/cursor.py)

      Definition of done: what must be done to consider the task complete?

      The exact Python version used, with patch level:

      $ python -c "import sys; print(sys.version)"

      3.9.19 (main, Mar 19 2024, 16:08:27)
      [Clang 15.0.0 (clang-1500.3.9.4)]
      (venv) ------------

      The exact version of PyMongo used, with patch level:

      $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"

      4.9.1
      True

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      Security Vulnerabilities

      If you've identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            rajeshwar.vellore@gmail.com Rajeshwar Dhayalan
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: