dmroeder / pylogix

Read/Write data from Allen Bradley Compact/Control Logix PLC's
Apache License 2.0
598 stars 182 forks source link

multiwrite Bug #173

Closed alexkireeff closed 3 years ago

alexkireeff commented 3 years ago

Preflight checks

Before you post an issue, ensure you have tried the minimal examples within the repo, or tried the pylogix-tester.

Type of issue

Description of issue

Code example explains it better than I can, but basically, calling comm.Write with the syntax for multiple tags when you have one tag causes it to not write anything to the tag. Expected behavior would be comm.Write writing the correct value to the tag.

Code

from pylogix import PLC

with PLC() as comm:
    comm.IPAddress = '192.168.0.2'

    comm.Write('TEST_DINT', 0)
    print(comm.Read('TEST_DINT').Value)
    # expected: 0
    # actual: 0

    r = comm.Write([('TEST_DINT', 1)])
    print(comm.Read('TEST_DINT').Value)
    print(r[0].Status) # Path segment error
    # expected: 1
    # actual: 0

    comm.Write([('TEST_DINT', 1), ('NOT A TAG', 1)])
    print(comm.Read('TEST_DINT').Value)
    # expected: 1
    # actual: 1

Versions

dmroeder commented 3 years ago

I see, so it appears that the issue is if you pass a list of 1 write, things go sideways. I'll sort this out.

dmroeder commented 3 years ago

Should be fixed with the latest commit (0.7.12). Thanks for bringing it to my attention.

alexkireeff commented 3 years ago

Awesome, thanks! I think you might have meant to return a list on line 118? https://github.com/dmroeder/pylogix/blob/master/pylogix/eip.py#L118

dmroeder commented 3 years ago

Ahh shoot, you are correct. I need to get it together :) ...and I updated pypi with that.

alexkireeff commented 3 years ago

Haha, it's all good. Thanks again!