“参数1具有意外的类型'str'”

2024-09-30 18:16:17 发布

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

我尝试使用PyKDE,PyKDE.kdecore.KStandardDirs来精确地说。根据documentation使用两个字符串调用此方法,根据PyQt4文档,我可以使用标准Python str而不是{}。 这不起作用:

>> KStandardDirs.locate()("socket", "foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): not enough arguments
>>> KStandardDirs.locate("socket", "foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: KStandardDirs.locate(): argument 1 has unexpected type 'str'

我不能使用QString,因为它似乎不存在:

^{pr2}$

我做错什么了?在


Tags: inmostfoostdinlinesocketcalllocate