无法确定为什么在初始化时出现类型错误__

2024-10-01 05:02:10 发布

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

希望有人能帮我。。。你知道吗

具备以下条件:

智能表_测试.py你知道吗

from pfcms.content import Content

def main():
    ss = Content()
    ss.smartsheet()

if __name__ == "__main__":
    main()

你知道吗内容.py你知道吗

import smartsheet as ss
class Content:
    """ PFCMS SmartSheet utilities """
    def __init__(self):
        self.token = 'xxxxxxxxxxxxxxxxxxx'

    def smartsheet(self):
         smartsheet = ss.Smartsheet(self.token)

但是,当我执行代码时,我得到:

python -d smartsheet_test.py 
Traceback (most recent call last):
File "smartsheet_test.py", line 8, in <module>
main()
File "smartsheet_test.py", line 5, in main
ss.smartsheet()
File "/xxxxx/pfcms/pfcms/content.py",     line 10, in smartsheet
smartsheet = ss.Smartsheet(self.token)
TypeError: __init__() takes exactly 1 argument (2 given)

self被传递到ss.Smartsheet(self.token)时,我所能看到的就是我传递的是参数self.token。目前我对Python的了解还不太深。非常感谢您的帮助。你知道吗

谢谢 亚历克斯


Tags: inpytestselftokenmaindefline