Error handling - bson import but not used pyflakes warning

Not sure why I get this error
NameError:name ‘bson’ is not defined

It’s imported in the db.py file at the top. Have not altered it.

‘’’

If an invalid ID is passed to get_movie, it should return None.

except (bson.errors.InvalidId) as _:

    """
    Ticket: Error Handling

    Handle the InvalidId exception from the BSON library the same way as the
    StopIteration exception is handled. Both exceptions should result in
    `get_movie` returning None.
    """

    return None

except Exception as e:
    return {}

‘’’

Hi @Chris_Duff ,

Please look at the following post:

Run.py error - no module named bson - M220P: MongoDB for Python Developers - MongoDB University Discussion Forum

Kanika