object is not JSON serializable

I'm having some trouble with Mongodb and Python (Flask). I have this api.py file, and I want all requests and responses to be in JSON, so I implement as such. # # Imports # from datetime import...

convert pymongo cursor to json

I know this is a fairly common problem. I'm writing a small Flask app and I'm trying to feed some queries back to the view. I've connected to my local MongoDB setup, and made a successful query...

Pagination with PyMongo and Flask

I found here a nice template for a pagination. However, this example was done with SQLlite, but I rewrote in order to be able to use PyMongo. This script creates users and save them to MongoDB...

How to know which version of PyMongo is running on my project

I'm developing a python project, in the requirements file I have three different types of PyMongo Flask-PyMongo==0.3.1 pymongo==2.7 flask-mongoengine==0.7.1 How can I define which version I'm using?

Running uwsgi with mongoengine

When I start uwsgi in multiprocess mode it says that pymongo should be run with connect=False. How can I setup connect=False if I run flask-mongoengine?

Flask - working outside of application context

I am testing a Flask application and am receiving a "working outside of application context" error. My file directory is as follows: api app.py __init__.py models __init__.py ...

Python cannot find flask_script

I am running a basic Flask application which uses flask script, but when I move the environment from Cloud 9 to a local installation on my Mac, it stops working. I get the following...

Python Flask Web API [Heroku]: It runs locally but shows Application Error when deployed

I have done a search on StackOverflow looking for an answer that will help me to get my Web API working, but somehow, I still don't have the answer that I need. I have followed all the necessarily...

Flask python app crashes on heroku

I tried pushing my code directly to Heroku for hosting but I got so many errors. Now, what I did was host the code on Github, and then link the git repo with Heroku. Now, the Heroku app was...

Flask Pymongo Objectid link not working

I am tring to access a new document from a mongo database collection named games by the _id. But for example if I access localhost:5000/solutie/5ae71f3e8e442b090e4c313bit is giving me the error:...

AttributeError: 'bytes' object has no attribute 'encode'

I am trying to build a user login system and I have successfully built the user register page, but when I try to login I get the error below. I am using flask, python3.6 and pymongo. This is the...

Flask app broken after bson update in Heroku

I have a Flask app that uses mongoengine and running on Heroku, init I use the bson package and after I updateded it from 0.5.6 to 0.5.7 I started getting the following error message: [2018-11-23...

unable to import 'pymongo'

So i learning flask web dev with mongodb. I am getting an error on the following code, import pymongo I am using virtualenv and the following are configured on it, obtained via pip3...

i am getting this error while connecting to mongodb Atlas: "dns.exception.Timeout: The DNS operation timed out after 30.000985383987427 seconds"

i am connecting my Flask app to mongodb atlas using Flask-PyMongo, but i am getting this error. "dns.exception.Timeout: The DNS operation timed out after 30.000985383987427 seconds" and after that...

Warning message in PyMongo: count is deprecated

def post(self): if db.users.find({"email": email}).count() != 0: abort(400, message="email is alread used.") DeprecationWarning: count is deprecated. Use Collection.count_documents...

UnsatisfiableError: The following specifications were found to be incompatible with each other:

I am running on Ubuntu 16.04 and I have run into issues with Anaconda. Due to package inconsistencies, I can no longer install, update or remove packages. $ conda info NVIDIA: no NVIDIA devices...

ERROR: You must give at least one requirement to install -- when running: pip install --upgrade --no-binary hdbscan

I am trying to install hdbscan in my PC which runs Windows 10 and has installed Python 3.6. My first attempt failed: (base) C:\WINDOWS\system32>pip install hdbscan --user Collecting hdbscan ...

Combine MongoDb clients: pyMongo and MongoEngine

In my web application, I use Flask as framework and MongoDB as persistent layer. There are multiple libraries to connect to MongoDB. I am currently using the low-level lib pyMongo. However, I...

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [WinError 10061] when trying to do basic MongoDB query

I'm currently trying to implement a user creation & login system in my Flask webapp using MongoDB Atlas (so it's a cloud server which I think makes a big difference for this error), mongoengine,...

Pymongo: Best way to remove $oid in Response

I have started using Pymongo recently and now I want to find the best way to remove $oid in Response When I use find: result = db.nodes.find_one({ "name": "Archer" } And get the...

Why does `conda list cudnn` have no output after `conda install pytorch torchvision cudatoolkit=10.2 -c pytorch` installation

*Please feel free to vote "Reopen" at the bottom of this question. The reason is that I have marked this as a duplicate although the answers there are not clear enough for this question.* As soon...

MongoDB keeps crashing due to WiredTiger related error

I've set up a Docker container using both Flask and MongoDB to make a web service. However, when it's time for MongoDB to set up, this batch of errors keeps appearing: mongodb |...

Getting: "ERROR: Failed building wheel for xmlsec" when using docker to containerize flask app

I am working to containerize my Flask app with docker, and am getting the following error when I run docker-compose build The app runs fine on my local machine. I have tried upgrading pip, using...

Pip Install Error Could Not Find A Version(although version is availiable)

I am getting a strange error when running pip install -r requirements.txt which...

Sudden Tensorflow / Keras Google Colab dependency problems `AttributeError: module 'tensorflow._api.v1.compat.v2' has no attribute '__internal__'`

I have running a machine learning model (Matterport's Mask R-CNN) in google colab for a couple of weeks. All of a sudden today I am unable to run any of my notebooks due to I think some kind of...

Python3 Import Error: undefined symbol: aes_hw_encrypt

I am trying to use DialogFlow to make a small talk chatbot on Raspberry Pi 4, and I am getting this error: ImportError:...

Getting Flask Error GET html 404 constantly

All of my .html files are present in templates folder. I'm getting a 404 error on one particular file called tour1.html I have defined its route as: @app.route('/tour1.html') def tour1(): ...

TypeError: Object of type Cursor is not JSON serializable

I'm creating a solar system application and having issues with the routing. I'm creating this app through with flask and using mongodb as a database. I've made sure that the files inserted into...

pymongo.errors.ServerSelectionTimeoutError error with MongoDB atlas and Flask

Hi I am trying to connect mongoDB atlas database to my flask api. when I use following code (with the correct password): from flask import Flask, jsonify, request, redirect from flask_pymongo...

Dockerize Flask: Error: While importing 'app', an ImportError was raised

I am trying to dockerize my Flask API. As soon as I try to start my image I receive the message: * Environment: production WARNING: This is a development server. Do not use it in a production...