Pymongo exception handling , unable to resolve errors in pymongo
<p>I am not able to perform exception handling it give unable to resolve error in pymongo.</p>

<p>What would be the reason for that , all the documentation i see for pymongo error handling gives the same code.</p>

<pre><code>from flask import Flask, request, jsonify
from flask_pymongo import PyMongo
from pymongo import MongoClient
import pymongo

app = Flask(__name__)
try:
    connection = MongoClient()
    db = connection.collection
except pymongo.errors.ConnectionFailure:
    result = {}
    result['success'] = False
    result['error'] = "Db connection Failed"
</code></pre>