Run.py and json_util error - what's wrong?

Hi Guys,
I have problem when I try open run.py file:

Traceback (most recent call last):
File “run.py”, line 1, in
from mflix.factory import create_app
File “/Users/wiktorkowalczyk/SynologyDrive/Repository/mflix-python/mflix/factory.py”, line 9, in
from bson import json_util, ObjectId
ImportError: cannot import name json_util

  1. when I try install json_util:
    Collecting json_util
    ERROR: Could not find a version that satisfies the requirement json_util (from versions: none)
    ERROR: No matching distribution found for json_util

Any solutions?
I will be grateful.
W.

Hi @Wiktor_39062,

Please check the below thread and follow all the instructions in README file step by step.

Kanika

Were you ever able to get past this error?

Hi @Dana_Bindra_18579,

Have you completed installing all the requirements from requirements.txt file?

Kanika

Yes. After I completed. It installed several modules (including the tests directory) in /Users/dbindra/Downloads/mflix-python. Some more info… The call it makes to factory.py and db.py, those folders are under /Users/dbindra/Downloads/mflix-python/mflix

init.py build factory.pyc

init.pyc db.py requirements.txt

pycache dbold.py run.py

api factory.py

(mflix) $ which python

/Users/dbindra/anaconda3/envs/mflix/bin/python

(mflix) $ which python3

/Users/dbindra/anaconda3/envs/mflix/bin/python3

(mflix) $ python -V

Python 3.7.4

mflix dbindra$ conda env list

Can you share more details about the error when you run python run.py?

Hello Everyone,

I think this error can be resolved by running the following set of commands in your terminal.

pip uninstall bson
pip uninstall pymongo
pip install pymongo

Replace pip with pip3 if you have multiple versions of python installed on your computer.

Please reply if you still encounter any problem even after following the above step

1 Like

Hi Everyone,
I have tried all the above steps and still not working for me. could you please help me out.
the requirements.txt have been installed successfully and updated the connection string in my .ini file successfully. but the below error pops up

Traceback (most recent call last):
File “run.py”, line 1, in
from mflix.factory import create_app
File “/Users/amr/MongoDB/M220P/mflix-python/mflix/factory.py”, line 3, in
from flask import Flask, render_template
ImportError: No module named flask

I even uninstalled falsk and reinstalled it again but error still persist

Hi @Amr_96482,

I know that you have already installed all the requirements but can you please try to do it again and see if that resolves the issue ?

Please run the command mentioned below from the mflix-python directory before running the run.py file:

  mflix-python > pip install -r requirements.txt

Thanks,
Shubham Ranjan
Curriculum Services Engineer

1 Like