python继承构造函数出现TypeError: unbound method __init__() must be called with Queue instance as first argument (got nothing instead),,python在构造函数中
python继承构造函数出现TypeError: unbound method __init__() must be called with Queue instance as first argument (got nothing instead),,python在构造函数中
python在构造函数中调用父类的__init__方法时出现下面的异常信息:
C:\Python27\python.exe "C:\Program Files\JetBrains\PyCharm 2.6.1\helpers\pydev\pydevd.py" --client 127.0.0.1 --port 49479 --file E:/outofmemory/svn/web/jobs/jobutils.pypydev debugger: startingConnected to pydev debugger (build 121.188)Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm 2.6.1\helpers\pydev\pydevd.py", line 1457, in <module> debugger.run(setup['file'], None, None) File "C:\Program Files\JetBrains\PyCharm 2.6.1\helpers\pydev\pydevd.py", line 1103, in run pydev_imports.execfile(file, globals, locals) #execute the script File "E:/outofmemory/svn/web/jobs/jobutils.py", line 57, in <module> taskQueue = JobQueue('svn_task') File "E:/outofmemory/svn/web/jobs/jobutils.py", line 28, in __init__ Queue.__init__(maxsize=maxsize)TypeError: unbound method __init__() must be called with Queue instance as first argument (got nothing instead)
这个异常的代码如下:
Class Foo(Bar): def __init__(self): Bar.__init__()
在构造函数中调用父类Bar的__init__方法时少传递了self参数,正确的做法应该是:
Class Foo(Bar): def __init__(self): Bar.__init__(self)
相关内容
- python2.7 使用super关键词 报错 TypeError: must be type, not cl
- python通过urlparse分析处网址中的域名,pythonurlparse,impo
- python通过参数方式向mysql中添加数据,pythonmysql,#!/usr/
- python数组插入新元素,python数组新元素,li=['a', 'b'
- 用Python实现一个简单的算术游戏,python实现算术,#!/us
- 在windows下安装python的easy_install工具,pythoneasy_install,在
- python通过cStringIO实现临时内存文件访问,pythoncstringio
- python通过wxPython打开并播放wav文件,pythonwxpython,''' wx_
- python计算牛顿迭代多项式,python牛顿多项式,''' p = eva
- N lowest eigenvalues of the tridiagonal matrix in python,,''' r = l
评论关闭