python Flask :TypeError: 'dict' object is not callable
flask 基于Werkzeug ..
@moudule.route('/upload', methods=['GET', 'POST'])
def upload_file():
global _flask_app
if request.method == 'POST':
file = request.files['file']
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(_flask_app.config['UPLOAD_FOLDER'], filename))
return json.dumps({'info': '上传完成'})
else:
return json.dumps({'info': '文件不存在或者不合法'})
else:
return json.dumps({'info': '方法不支持'})
请求处理函数中如果直接 :
return {'info': '方法不支持'}
就会报 TypeError: 'dict' object is not callable 的错误
python Flask :TypeError: 'dict' object is not callable的更多相关文章
- Python: TypeError: 'dict' object is not callable
问题: TypeError: 'dict' object is not callable 原因: dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...
- TypeError: 'module' object is not callable 原因分析
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name self.Sex = sex def ToS ...
- TypeError: 'dict' object is not callabled
Traceback (most recent call last): File "/root/Desktop/JuniperBackdoor-master/censys.py", ...
- 解决Flask和Django的错误“TypeError: 'bool' object is not callable”
跟着欢迎进入Flask大型教程项目!的教程学习Flask,到了重构用户模型的时候,运行脚本后报错: TypeError: 'bool' object is not callable 这是用户模型: c ...
- Python TypeError: 'module' object is not callable 原因分析
今天尝试使用pprint进行输出,语句为 >>>import pprint >>>pprint(people) 结果报错,TypeError: 'module' o ...
- python import 错误 TypeError: 'module' object is not callable
python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...
- python -- TypeError: 'module' object is not callable
文件: 代码: import pprintmessge = 'It was a bringht cold day in April,and the clocks were striking thrir ...
- Python学习笔记1 -- TypeError: 'str' object is not callable
Traceback (most recent call last): File "myfirstpython.py", line 39, in <module> pri ...
- python TypeError: 'int' object is not callable 问题解决
TypeError: 'int' object is not callable 这个错误的原因很简单 看下面的程序: def loss(a,b): return a-b loss = 0 loss = ...
随机推荐
- MongoDB安装及shell简介
MongoDB安装 MongoDB具有跨平台的优良特性,提供了对主流的操作系统支持,我们可以根据自己使用的操作系统,选择下载对应的安装包. 图 1. MongoDB支持各个版本的操作系统 MongoD ...
- Windows2003 架设VPN服务
一.确保Windows防火墙关闭. 在我的电脑上右键=>管理,在左边窗口找到“服务和应用程序”,展开,单击“服务”,在右边窗口中找到“Windows Firewall/Internet Conn ...
- 使用UEditor无法SetContent的问题
无法SetContent是因为 <script id="txtContent" name="txtContent" type="text/pla ...
- [BTS] Can't update the assembly.
Error Message In BizTalk =================================== Failed to add resources to application. ...
- C#与数据库访问技术总结(十五)之 DataAdapter对象代码示例
DataAdapter对象代码示例 下面的代码将说明如何利用DataAdapter对象填充DataSet对象. private static string strConnect=" data ...
- JfreeChart使用(转载)
http://www.cnblogs.com/xingyun/ http://www.huosen.net/archives/156.html(此篇除了struts2外,还介绍了servlet下Jfr ...
- 大数据并行计算利器之MPI/OpenMP
大数据集群计算利器之MPI/OpenMP ---以连通域标记算法并行化为例 1 背景 图像连通域标记算法是从一幅栅格图像(通常为二值图像)中,将互相邻接(4邻接或8邻接)的具有非背景值的像素集合提取出 ...
- paip.语义分析--单字词名词表
paip.语义分析--单字名词表 INSERT INTO t (word) SELECT DISTINCT word FROM `word_main` where tsisin is not n ...
- paip.-Djava.library.path -Djava.ext.dirs= 的区别
paip.-Djava.library.path -Djava.ext.dirs= 的区别 作者Attilax 艾龙, EMAIL:1466519819@qq.com 来源:attilax的专 ...
- HTML+CSS小实战案例
HTML+CSS小实战案例 登录界面的美化,综合最近所学进行练习 网页设计先布局,搭建好大框架,然后进行填充,完成页面布局 <html> <head> <meta htt ...