TypeError:super()至少需要1个参数(给定0)

时间:2015-12-06 04:21:59

标签: python

使用以下代码:https://github.com/SmBe19/praw-OAuth2Util

收到此错误:

Traceback (most recent call last):
  File "update_sidebar.py", line 6, in <module>
    o = OAuth2Util.OAuth2Util(r)
  File "/usr/lib/python2.7/site-packages/OAuth2Util/OAuth2Util.py", line 162, in __init__
    self.refresh()
  File "/usr/lib/python2.7/site-packages/OAuth2Util/OAuth2Util.py", line 364, in refresh
    self._get_new_access_information()
  File "/usr/lib/python2.7/site-packages/OAuth2Util/OAuth2Util.py", line 254, in _get_new_access_information
    self._start_webserver(url)
  File "/usr/lib/python2.7/site-packages/OAuth2Util/OAuth2Util.py", line 229, in _start_webserver
    self.server = OAuth2UtilServer(server_address, OAuth2UtilRequestHandler, authorize_url)
  File "/usr/lib/python2.7/site-packages/OAuth2Util/OAuth2Util.py", line 58, in __init__
    super().__init__(server_adress, handler_class, bind_and_activate)
TypeError: super() takes at least 1 argument (0 given)

通过做:

import praw
import OAuth2Util

user_agent = "sidebar helper"
r = praw.Reddit(user_agent=user_agent)
o = OAuth2Util.OAuth2Util(r)

代码遗漏了什么?

1 个答案:

答案 0 :(得分:0)

根据@Ryan的说法,你的问题是你是用Python 2而不是Python 3运行它。在Python 3中运行它应该修复它。