系统信息:
configparser==3.5.0
cpppo==3.9.7
greenery==2.1
ipaddress==1.0.18
pycomm==1.0.8
pyreadline==2.1
pytz==2017.2
python==2.7.13
我使用的代码:
from pycomm.ab_comm.clx import Driver as ClxDriver
import logging
if __name__ == '__main__':
c = ClxDriver()
if c.open('IPADDRESSHERE'):
print(c.read_tag(['new_Bool']))
c.close()
https://github.com/ruscito/pycomm
这是运行powershell的结果:
PS C:\Users\Tom\Documents\PythonProjects>python pycomm2.py
回溯(最近一次呼叫最后一次):
文件“pycomm2.py”,第10行,in
打印(c.read\u标记(['new\u Bool'))
自记录器警告(自状态)
AttributeError:“Driver”对象没有属性“logger”
PS C:\Users\Tom\Documents\PythonProjects>
我一直在寻找这个AttributeError并试图找到解决方案,但我认为我找到的解决方案超出了我的想象。如果为了让这个问题有意义,我没有提供一些细节,请告诉我。
编辑:
from pycomm.ab_comm.clx import Driver as ClxDriver
import logging
if __name__ == '__main__':
logging.basicConfig(
filename="ClxDriver.log",
format="%(levelname)-10s %(asctime)s %(message)s",
level=logging.DEBUG
)
c = ClxDriver()
if c.open('IPADRESSHERE'):
print(c.read_tag(['new_Bool']))
c.close()
PS C:\Users\Tom\Documents\PythonProjects>python pycommtest.py
回溯(最近一次呼叫最后一次):
打印(c.read\u标记(['new\u Bool'))
文件“C:\Python27\lib\site packages\pycomm\ab\u comm\clx.py”,第359行,在read\u标记中
AttributeError:“Driver”对象没有属性“logger”