V
V
Vladimir Gunaev2019-03-05 15:32:27
Python
Vladimir Gunaev, 2019-03-05 15:32:27

Python, Flask error?

Good afternoon, tell me what the problem is until today everything worked, today I opened the project and I see the following, I work in the paycharm environment
C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\python.exe E:/python/ app/app.py
Traceback (most recent call last):
File "E:/python/app/app.py", line 1, in
from flask import Flask, render_template, request, json
File "C:\Users\Administrator\ AppData\Local\Programs\Python\Python37-32\lib\site-packages\flask\__init__.py", line 19, in
from jinja2 import Markup, escape
File "C:\Users\Administrator\AppData\Local\Programs\ Python\Python37-32\lib\site-packages\jinja2\__init__.py", line 33, in
from jinja2.environment import Environment, Template
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\jinja2\environment.py", line 15, in
from jinja2 import nodes
File "C:\Users\Administrator \AppData\Local\Programs\Python\Python37-32\lib\site-packages\jinja2\nodes.py", line 19, in
from jinja2.utils import Markup
File "C:\Users\Administrator\AppData\Local\Programs \Python\Python37-32\lib\site-packages\jinja2\utils.py", line 41, in
_slash_escape = '\\/' not in json.dumps('/')
AttributeError: module 'json' has no attribute 'dumps'
Process finished with exit code 1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolai, 2019-05-29
@Sir_MaNiAl

As Roman correctly noted - "if he didn't change anything." Make sure there is no json module in the project directory. (json.py file or json directory with __init__.py file). As soon as you find it, rename it and no longer use names that match the names of third-party modules or from the standard library. Good luck!

R
Roman, 2019-03-06
@skipirich

Well, if you are sure that you didn’t change anything, but it suddenly died. Then before this _slash_escape = '\\/' not in json.dumps('/') insert print(json.__file__). In theory, you will see the path to json.pyc, so you need to bang this json.pyc, maybe it will heal.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question