title: Cannot convert MotorCursor object to list in async function using standard method
body: <p>I have been trying to have an async function get data from a Motor database in Python and get the list of data corresponding to the search. Here is the function to get the data and the one to print it:</p>
  
  <pre><code>async def do_find_by_run_name(run_name):
      """
      :param run_name: the name of a the run being searched for (string)
      :return: MotorCursor for run found
      """
      cursor = db.data_collection.find({"run_name":run_name})
      loop = asyncio.get_event_loop()
      return cursor
  
  async def print_arr(cursor):
      for d in await cursor.to_list(length=2):
          pprint.pprint(d)
  </code></pre>
  
  <p>I have a PyQt slot which I want to use to call the find_by_run_name function on a button press. Here is the code for that slot:</p>
  
  <pre><code>@pyqtSlot()
  def on_find_runs_button_clicked(self):
      try:
          new_loop = asyncio.get_event_loop()
          d = new_loop.run_until_complete(server.do_find_by_run_name("default"))
          print(d)
          new_loop = asyncio.get_event_loop()
          v = new_loop.run_until_complete(server.print_arr(d))
      except Exception as err:
          try:
              raise TypeError("Again !?!")
          except:
              pass
          traceback.print_exc()
  </code></pre>
  
  <p>When I press the button corresponding to this slot I see the following in my terminal:</p>
  
  <pre><code>AsyncIOMotorCursor(&lt;pymongo.cursor.Cursor object at 0x06F51EB0&gt;)
  Traceback (most recent call last):
    File "C:/Users/Rohan Doshi/Documents/websockets/server\GUI.py", line 93, in on_find_runs_button_clicked
      v = new_loop.run_until_complete(server.print_arr(d))
    File "C:\Users\Rohan Doshi\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py", line 468, in run_until_complete
      return future.result()
    File "C:/Users/Rohan Doshi/Documents/websockets/server\server.py", line 130, in print_arr
      for d in await cursor.to_list(length=2):
  RuntimeError: Task &lt;Task pending coro=&lt;print_arr() running at C:/Users/Rohan Doshi/Documents/websockets/server\server.py:130&gt; cb=[_run_until_complete_cb() at C:\Users\Rohan Doshi\AppData\Local\Programs\Python\Python36-32\lib\asyncio\base_events.py:177]&gt; got Future &lt;Future pending&gt; attached to a different loop
  </code></pre>
  
  <p>This indicates to me that the do_find_by_run_name function ran properly but that there is an issue with running the print_arr function.</p>
  
  <p>In an attempt to fix this issue do_find_run_name was changed to:</p>
  
  <pre><code>async def do_find_by_run_name(run_name):
      """
      :param run_name: the name of a the run being searched for (string)
      :return: MotorCursor for run found
      """
      cursor = db.data_collection.find({"run_name":run_name})
      print(cursor)
      for d in await cursor.to_list(length=2):
          pprint.pprint(d)
  </code></pre>
  
  <p>and I changed my PyQt slot to:</p>
  
  <pre><code>@pyqtSlot()
  def on_find_runs_button_clicked(self):
      try:
          new_loop = asyncio.get_event_loop()
          future = asyncio.run_coroutine_threadsafe(
              server.do_find_by_run_name("default"),
              new_loop
          )
          assert future.result(timeout=10)
      except Exception as err:
          try:
              raise TypeError("Again !?!")
          except:
              pass
          traceback.print_exc()
  </code></pre>
  
  <p>When this change is made I don't see anything printed. It seems like the do_find_run_name couroutine is never executed.</p>