pjkundert / cpppo

Communications Protocol Python Parser and Originator -- EtherNet/IP CIP
https://hardconsulting.com/products/6-cpppo-enip-api
Other
332 stars 109 forks source link

object has not attribute 'items' when writing attribute using get_attribute.proxy #33

Closed TwoRedCells closed 7 years ago

TwoRedCells commented 7 years ago
from cpppo.server.enip.get_attribute import proxy as plc

host = "192.168.178.15"
param = "@0x6b/1/1=(DINT)5"
fanuc = plc(host=host)
try:
    with fanuc:
        result, = fanuc.write(param)
except Exception as e:
    print param, e

When I issue this I get @0x6b/1/1=(DINT)5 'str' object has no attribute 'items' I have tried making param a list of strings, list of tuples, parameter_substitution, but I get the same error, with a different type instead of str.

I am trying to achieve the same programmatically as python -m cpppo.server.enip.get_attribute -a 192.168.178.15 -S "@0x6b/1/1=(DINT)5".

pjkundert commented 7 years ago

I just tried running:

python -m cpppo.server.enip -v SCADA@0x6b/1/1=DINT

to simulate a rough approximation of the Fanuc data, and then ran:

from cpppo.server.enip.get_attribute import proxy as plc

host = "0.0.0.0"
param = "@0x6b/1/1=(DINT)5"
fanuc = plc(host=host)
try:
    with fanuc:
        result, = fanuc.write(param)
    print param, '==', result
except Exception as e:
    print param, e

(because my simulator was on my local machine). It worked.

$ python testproxy.py
@0x6b/1/1=(DINT)5 == True

Try:

I'm not sure what else to suggest...