出错如下图所示:

原来是因为把__name__写成_name_, 下图为正确结果:

python调用对象属性出错:AttributeError: 'function' object has no attribute '_name_'的更多相关文章

  1. flask_route错误:AttributeError: 'function' object has no attribute 'route'

    问题: 路由完全正确,当只有一个名为home的函数处理这个路由时候,下一个路由处理函数,总是提示没有这个rotue属性 Traceback (most recent call last): File ...

  2. pycharm install python packaging tools时遇到AttributeError: '_NamespacePath' object has no attribute 'sort'错误

    pycharm install python packaging tools时报错AttributeError: '_NamespacePath' object has no attribute 's ...

  3. tensorboardX使用中 AttributeError: 'function' object has no attribute 'graph'

    最近在使用tensorboardX可视化网络结构,因为tensorboardX并非pytorch原生的可视化工具,所以版本之间并不兼容 在使用的过程中会遇到,AttributeError: 'func ...

  4. python调用WebService遇到的问题'Document' object has no attribute 'set'

    代码: from suds import WebFault from suds.client import Client url = 'http://******/bns/PtDataSvc.asmx ...

  5. Scrapy Crawl 运行出错 AttributeError: 'xxxSpider' object has no attribute '_rules' 的问题解决

    按照官方的文档写的demo,只是多了个init函数,最终执行时提示没有_rules这个属性的错误日志如下: ...... File "C:\ProgramData\Anaconda3\lib ...

  6. Windows解决多版本python执行pip3时出错AttributeError: module 'enum' has no attribute 'IntFlag'?

    摘要: 本机装有python2.7和python3.6,执行pip和pip2时没有问题,执行pip3时提示: C:\Users\>pip3 Traceback (most recent call ...

  7. 执行: python manage.py makemigrations报AttributeError: 'str' object has no attribute 'decode'

    找到错误代码(line146):query = query.encode(errors='replace') 解决方法:把decode改为encode即可.

  8. AttributeError: 'function' object has no attribute 'as_view'

    我的描述:当我启用jwt_required来进行token验证的时候,我提示错误; 解决方案: 修改前代码: 修改后代码: 多看书.多多了解.多看看世界...

  9. Python使用suds调用webservice报错解决方法:AttributeError: 'Document' object has no attribute 'set'

    使用python的suds包调用webservice服务接口,报错:AttributeError: 'Document' object has no attribute 'set' 调用服务接口代码: ...

随机推荐

  1. Tomcat源码(二):tomcat启动之前的初始化

    当tomcat启动的时候 首先会加载 org.apache.ctalina.startup.BootStrap类. 使用eclipse或idea启动tomcat其实就是在启动这个类的main方法 根据 ...

  2. 8、springboot之定时任务

    @Configuration @EnableScheduling public class SchedulingConfig { @Scheduled(cron = "0/5 * * * * ...

  3. C++中细节知识点

    C++中常识小知识: 1.在C++的类中成员变量与成员函数默认为私有的,结构体中的成员变量与成员函数默认为公有的. 2.C++中this关键字是指针,指向当前对象. 3.在C++中一般类的成员变量与成 ...

  4. flex固定底部栏

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. java 文件的上传和下载

    主要介绍使用 smartupload.jar 包中的方法对文件的上传和下载.上传时文件是存放在服务器中,我用的是tamcat. 首先建立一个servlet 类,对文件的操作 package com.d ...

  6. java.util.concurrent.Semaphore 使用

    1. 概述 Semaphore(信号)  并不存在真正的许可 只是维护一个计数器, 通常用来限定进入一些资源的线程数 accquire()  方法获取许可 成功则计数器值-1 没有则阻塞直到一个可用的 ...

  7. git日常使用

    git强制回滚指定版本git reset --hard xxx(版本名) git强制推送git push -f remote(远程地址) branch(远程分支) 查看远程分支 git branch ...

  8. JS小案例(基础好烦恼少)----持续更新

    *************************************************** <!DOCTYPE html> <html lang="en&quo ...

  9. JavaScript中实现DI的原理

    什么是依赖注入 按照上面图的流程中我们可以知道我们需要实现这么几件事: 提供一个服务容器 为目标函数注册需要的依赖 获取目标函数注册的依赖项 通过依赖项来查询对应服务 将获取的依赖项传入目标函数 提供 ...

  10. ArcGIS中国工具(ArcGISCTools)2.0正式发布

    ArcGIS中国工具,简称CTools,集成在ArcMap10.0, ArcMap10.1, ArcMap10.2,安装就可以直接使用.主要有以下功能 1.接合图表生成2.图框工具3.制图工具4.图形 ...