AttributeError:P4脚本中的记录器

时间:2015-05-05 14:18:35

标签: python perforce

我有一个简单的脚本,通过Python API连接到Perforce并打印连接信息。

from P4 import P4, P4Exception
p4 = P4()
p4.port = "111"
p4.user = "xxx"
p4.client = "yyy"
p4.connect()
print p4
print p4.run("info") # here is where I get an error

我收到此错误: AttributeError: logger。这是追溯

Traceback (most recent call last):
  File "p4try.py", line 17, in <module>
    print p4.run("info")
  File "C:\..\p4python\dist\p4python-2014.2.962887\P4.py
", line 582, in run
    if self.logger:
  File "C:\..\p4python\dist\p4python-2014.2.962887\P4.py
", line 516, in __getattr__
    raise AttributeError(name)
AttributeError: logger
Press any key to continue 

有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:2)

此时没有定义

记录器。如果您不忘记调用某些init方法,请查看Perforce文档。如果没有,请联系开发人员以声明错误,同时,您可以使用以下行修补它:

...
p4.connect()
p4.logger = False # patch the problem
print p4
...