环境说明:

Centos 7 + Python3.6 + Cesi 2.7.1

按照官网说明运行,服务启动正常,在登录界面输入密码后提示密码错误。

打开浏览器开发者工具,查看对应的登录POST请求,提示500错误。

回到cesi服务器,查看日志报错如下:

File "/lib/python3.6/site-packages/flask_sqlalchemy/__init__.py", line 915, in apply_driver_hacks
sa_url.database = os.path.join(app.root_path, sa_url.database)
AttributeError: can't set attribute

看一下异常位置

 def apply_driver_hacks(self, app, sa_url, options): # sa_url输入参数"""This method is called before engine creation and used to injectdriver specific hacks into the options.  The `options` parameter isa dictionary of keyword arguments that will then be used to callthe :func:`sqlalchemy.create_engine` function.The default implementation provides some saner defaults for thingslike pool sizes for MySQL and sqlite.  Also it injects the setting of`SQLALCHEMY_NATIVE_UNICODE`."""if sa_url.drivername.startswith('mysql'):sa_url.query.setdefault('charset', 'utf8')if sa_url.drivername != 'mysql+gaerdbms':options.setdefault('pool_size', 10)options.setdefault('pool_recycle', 7200)elif sa_url.drivername == 'sqlite':pool_size = options.get('pool_size')detected_in_memory = Falseif sa_url.database in (None, '', ':memory:'):detected_in_memory = Truefrom sqlalchemy.pool import StaticPooloptions['poolclass'] = StaticPoolif 'connect_args' not in options:options['connect_args'] = {}options['connect_args']['check_same_thread'] = False# we go to memory and the pool size was explicitly set# to 0 which is fail.  Let the user know thatif pool_size == 0:raise RuntimeError('SQLite in memory database with an ''empty queue not possible due to data ''loss.')# if pool size is None or explicitly set to 0 we assume the# user did not want a queue for this sqlite connection and# hook in the null pool.elif not pool_size:from sqlalchemy.pool import NullPooloptions['poolclass'] = NullPool# if it's not an in memory database we make the path absolute.if not detected_in_memory:sa_url.database = os.path.join(app.root_path, sa_url.database) #报错位置unu = app.config['SQLALCHEMY_NATIVE_UNICODE']if unu is None:unu = self.use_native_unicodeif not unu:options['use_native_unicode'] = False

很明显,这里应该是对输入参数sa_url的内部变量赋值触发当前python语法规则,可以确定是flask_sqlalchemy这个包和当前python版本不兼容的原因。

看下cesi的requirements.txt文件

flask==1.1.2
flask-sqlalchemy==2.4.3
psycopg2-binary==2.8.5
pymysql==0.9.3
tomlkit==0.5.11

要求flask-sqlalchemy==2.4.3,cesi的github上实例用的python3.4,我的环境是python3.6,显然我应该升级flask-sqlalchemy,所以升级到最新版本

pip install flask-sqlalchemy==2.5.1

重新运行cesi,一切正常,问题修复。

Cesi运行报错AttributeError: can‘t set attribute相关推荐

  1. 第一:Python+Allure运行报错AttributeError: module ‘allure‘ has no attribute ‘severity_level‘

    1.很多查询结果都是先卸载pytest-allure-adaptor,然后再安装allure-pytest pip3 uninstall pytest-allure-adaptor 2.pip3 in ...

  2. 第一次使用scrapy爬豆瓣top250 报错 AttributeError Requset has no attribute dont_filter 和 meta

    首次学习scrapy框架来爬取豆瓣Top250,在写完代码执行时,报了AttributeError: 'Request' object has no attribute 'meta' 还有Attrib ...

  3. 运行项目时flask_sqlalchemy报错AttributeError: ‘LocalStack‘ object has no attribute ‘__ident_func__‘

    运行项目时flask_sqlalchemy报错AttributeError: 'LocalStack' object has no attribute '__ident_func__' 1.原因 2. ...

  4. Kali运行smod框架报错‘Conf‘ object has no attribute ‘use_dnet‘

    Kali运行smod框架报错'Conf' object has no attribute 'use_dnet' 报错信息如下 解决方法 报错信息如下 // smod运行报错详细内容 Traceback ...

  5. etree.html 报错 AttributeError:‘function’ object has no attribut ‘HTML’

    etree.html 报错 1.Pycharm 中lxml没有etree模块的解决方法: 之前是: from lxml import etree tree = etree.HTML( ) python ...

  6. SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策

    SAP WM 自动创建TO单的JOB运行报错 - Enter the storage unit type - 对策 报错如下: 详细信息: Log for automatic creation of ...

  7. python3运行报错:TypeError: Object of type ‘type‘ is not JSON serializable解决方法(详细)

    python3运行报错:TypeError: Object of type 'type' is not JSON serializable解决方法(详细) 参考文章: (1)python3运行报错:T ...

  8. python 报错 AttributeError: module ‘time‘ has no attribute ‘clock 解决方法

    源码如下: #引入所需要的时间库 import datetime import time#程序计时器,启动计时器 start = time.clock()#中间是放置需要测试运行时间的程序代码#计算启 ...

  9. appium运行报错java.net.SocketException: socket write error

    这个错我调了 快两天一点头绪没有,脚本正常跑没问题,但是就是控制台输出信息报错,没法定位问题在哪.报错如图: 虽然这个报错不影响测试结果,但是本人有强迫症,一定要查出究竟: 我的尝试: 1.那天试验, ...

最新文章

  1. C# 检测文件是否被其他进程占用
  2. TabHost中使用startActivityForResult无法接收返回值的解决方案
  3. 教你怎么快速配置 React
  4. MIPS 通用寄存器
  5. 1!+2!+3!+…+10!的和
  6. java程序员_Java和Python的区别 好程序员帮大家解读
  7. SAP License:整理的SAP参数文件
  8. 想买一辆别克GL8用做家庭用车,跑长途自驾游可以吗?
  9. Uber再受万点暴击:亚利桑那州无限期吊销其路测资格
  10. Android ListView中EditView再次焦点获取
  11. 已解决——pycharm在同目录下import,pycharm会提示错误,但是可以运行
  12. GTK测试程序(十四)
  13. 关于Jquery ajax调用一般处理程序Handler报500 错误(Internal Server Error)解决办法
  14. 阿里资深架构师总结:顶级高手都具备的四种思维模型
  15. PHP有哪些基本数据类,PHP的基本数据类型
  16. 计算机专硕双导师,【计算机专业论文】双导师制人才培养计算机专业论文(共1315字)...
  17. python三国演义人物 统计分析前20个_python爬取三国演义文本,统计三国演义中出场次数前30的人物,并生成词云、图表...
  18. 显示接口DP HDMI VGA DVI LVDS的区别
  19. 免费的几款内网穿透工具
  20. vue常见面试题(附带答案)超实用!!建议收藏!!

热门文章

  1. 使用 Sqoop 将 30W+ MySQL 数据导入 Hive
  2. CSS基础学习(二)
  3. 开源项目Krita学习(二)
  4. 随机梯度下降法概述与实例
  5. 安装Visio + Windows Installer 与即点即用版本冲突 + 卸载Office + 重装Office
  6. Zookeeper框架Curator使用
  7. 小米运维部14年校招笔试题A的个人答案
  8. elementui级联选择器空children导致选择无法显示的问题
  9. CWnd和HWND的区别
  10. Python中制表符\t的使用