[问题现象]

在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError:  got multiple values for argument

只是很简单的调用

from tsu2Runner import AndroidActions

auto = AndroidActions()
auto.log(1, 2, text='应用市场', name='lucy')
class AndroidActions(object):
def a(self, name, *args, **kwargs):
print('i am a')
print(name)
print(args)
print(kwargs) def log(self, fun):
def wrapper(self, *args, **kwargs):
print(args)
# fun(self, *args, **kwargs)
P = AndroidActions()
P.a('', *args, **kwargs)
fun(self, *args, **kwargs)
pass
return wrapper

经过翻阅查找,意思是传参错误,但是并不知道是哪里错了,因为看代码是完全没问题的!!!自己在另一边写了测试代码也完全可以运行的,但是在项目代码中就会报错

[问题原因]

折腾了一下午,最后依靠谷爹进行一番查阅找到了原因

原因是字典d里面还存在关键字'name‘,python解释器报错

[解决办法]

在传参的时候,避免使用python自带的常用关键字

python报错 TypeError: a() got multiple values for argument 'name'的更多相关文章

  1. 关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument 'column' 的解决方案

    关于Jupyter Notebook无法自动补全(Autocompletion),报错TypeError: __init__() got an unexpected keyword argument ...

  2. 解决tensorflow模型保存时Saver报错:TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray

    TypeError: TF_SessionRun_wrapper: expected all values in input dict to be ndarray 对于下面的实际代码: import ...

  3. Python报错TypeError: '<' not supported between instances of 'str' and 'int'

    n = input() if n>=100:print(int(n)/10) else:print(int(n)*10) 报错内容: Traceback (most recent call la ...

  4. python 报错TypeError: 'range' object does not support item assignment,解决方法

    贴问题 nums = range(5)#range is a built-in function that creates a list of integers print(nums)#prints ...

  5. 【转】python 调用super()初始化报错“TypeError: super() takes at least 1 argument”

    一.实验环境 1.Windows7x64_SP1 2.Anaconda2.5.0 + python2.7(anaconda集成,不需单独安装) 二.实验步骤 2.1 在python中有如下代码: cl ...

  6. python报错 TypeError: string indices must be integers

    所以在读取字典的时候,最好先判断类型,然后再查看它是否已经有这样的属性: type(mydict) == type({})             #检查不是字典 如果是字典,再看看有没有这样的属性: ...

  7. Python TypeError: __init__() got multiple values for argument 'master'(转)

    转自:https://stackoverflow.com/questions/33153404/python-typeerror-init-got-multiple-values-for-argume ...

  8. python3.7的celery报错TypeError: wrap_socket() got an unexpected keyword argument '_context'

    原启动方法为: 起执行任务的服务 elery worker -A celery_task -l info -P eventlet 起提交任务的服务 celery beat -A celery_task ...

  9. Django 生成数据库表时的报错TypeError: __init__() missing 1 required positional argument: 'on_delete'

    原因及解决办法: https://www.cnblogs.com/phyger/p/8035253.html

随机推荐

  1. 神经大条的我-->记录我那些容易忘记的知识点

    1.springmvc中每次进来的request都是保存在ThreadLocal里的,所以不会存在线程问题.可以直接用@Autowired全局注入  参考地址:https://my.oschina.n ...

  2. Junit简单的案例

    Calculator: public class Calculator { public double add(double number1, double number2) { return num ...

  3. 动态规划(1)——最长子序列(LCS)问题

    最长子序列问题:从中找出最长的字符序列,比如: cnblogs和belong.这两个字符串的最长子序列就是blog. 动态规划:通过分解大问题,不断的将大问题变成小问题,最终整合所有解,得出最优解(和 ...

  4. Maven(三)使用 IDEA 创建一个 Maven 项目

    利用 IDEA 创建一个 Maven 项目 创建 Maven 项目 选择 File --> New --> Project 选中 Maven 填写项目信息 选择工作空间 目录结构 ├─sr ...

  5. local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class serialVersionUID = 7725746634795906143

    local class incompatible: stream classdesc serialVersionUID = 4125096758372084309, local class seria ...

  6. [leetcode ]429. N-ary Tree Level Order Traversale (easy)

    原题 思路: bfs,每一层遍历一次加到一个vector,同时把该点的子元素加到queue中. class Solution { public: vector<vector<int> ...

  7. JedisClient操作redis 单机版和集群版

    一.在pom文件中添加依赖 <!-- https://mvnrepository.com/artifact/redis.clients/jedis --> <dependency&g ...

  8. C#命名规范(简述)

    命名空间,类,事件,接口,常量,属性,方法使用Pascal命名,即首字母大写  参数,变量(类字段)使用camel命名法,即首字母小写. Pascal 方式--所有单词第一个字母大写,其他字母小写.  ...

  9. vim批量注释和反注释快捷键

    vim批量注释和反注释快捷键 我是个vim新手,非常喜欢这个工具,因为纯手工操作吧.可是有些快捷键还是不知道,写Python的时候经常要调试,会批量注释掉一些代码,vim不像pycharm那样 Ctr ...

  10. Codeforces Round #565 (Div. 3)

    传送门 A. Divide it! •题意 给定一个数n, 每次可以进行下列一种操作 1.如果n可以被2整除,用n/2代替n 2.如果n可以被3整除,用2n/3代替n 3.如果n可以被5整除,用4n/ ...