TypeError:object()不接受Python 3.6.3的参数

2024-09-27 00:13:12 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行$ python -m weatherterm -a USNY1192:1:US -p WeatherComParser -td 为了在终端中输出解析后的数据,我得到以下错误:

Traceback (most recent call last):
  File "C:\Python36\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec)
  File "C:\Python36\lib\runpy.py", line 85, in _run_code
      exec(code, run_globals)
  File "C:\Users\Reza\weather-app\weatherterm\weatherterm\__main__.py", line 81, in <module>
      parser = cls()
  File "C:\Users\Reza\weather-app\weatherterm\weatherterm\parsers\weather_com_parser.py", line 25, in __init__
      self._request = Request(self._base_url)
TypeError: object() takes no parameters

如果您能告诉我们这里出了什么问题,我将不胜感激:

^{pr2}$

Tags: runinpymainliblinecodeusers
1条回答
网友
1楼 · 发布于 2024-09-27 00:13:12

看看调用堆栈,我觉得weatherterm/core中的Request类有问题/请求.py. 请求类的初始值设定项应如下所示:

class Request:
    def __init__(self, base_url):
        ...

确保初始值设定项也获得一个base_url参数。在

相关问题 更多 >

    热门问题