Python cpppo won't display string data type from PLC









up vote
2
down vote

favorite












I have the cpppo Python package installed and I have an ABLogix IO Server with 192.168.1.100 IP that I typically connect to it with different software (not python) as 192.168.1.100,1,0.



My problem is I cannot get it to bring back the value of a tag on an accessible PLC when that tag's data type is set to String in the PLC RSLogix 5000 code. The string value I'm testing with is a 12 character alphanumeric string if that matters so U123HTS76312



My question is to know if someone can see maybe something I'm overlooking that will allow me to get the value from a tag where the PLC has it defined as a String data type?




Note: According to the README.org in the client.connector.get_attribute_single and .get_attributes_all section, it states "To access Get Attribute data with CIP type conversion, use cpppo.server.enip.get_attribute’s proxy classes, instead."



  • I think using for message in source.read([(TagName, "SSTRING")], portLink) in the non-working example "c." below is specifying the CIP
    type but it doesn't work




  • Potential Related Issue: Problem reading/writing STRING data types




    • I get this same error if I try to write a value so that's why I think it may be related.




      python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X=(STRING)123HFGR45678"

      11-08 10:51:47.692 MainThread enip.cli WARNING validate Client Single Write Tag UL1_LOTCODE_STR_X returned non-zero status: Status 255 [8455]
      UL1_LOTCODE_STR_X <= ['123HFGR45678']: 'Status 255 [8455]'






The Context Begins. . .




1. It Works. . .



I have a tag named UL1_TICKETWEIGHT_X which is set as a DINT in the PLC logic that I get the correct sensor data value back from as expected using the below logic.



Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_TICKETWEIGHT_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output



UL1_TICKETWEIGHT_X == 55000 
['2018-11-07 19:59:24.853017', [55000]]



2. It Doesn't Work. . .



I have a tag named UL1_LOTCODE_STR_X which is set as a String in the PLC logic that does not get back the correct data from the sensor with the various things I've tried below to show a few.



I did many other things and read over slews of the code in the files hoping I could figure out which class or method to use or what arguments to pass to what, and so forth.



I have also set the value of UL1_LOTCODE_STR_X to a DINT type value (it is still String type though at PLC level) such as 15 and it still has the same problem



a. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 11, in <module>
for message in source.read(TagName, portLink):
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 431, in read
for val,(sts,(att,typ,uni)) in reader:
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 606, in read_details
depth=self.depth, multiple=self.multiple, timeout=self.timeout )):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state


b. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read_details(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 12, in <module>
for message in source.read_details(TagName, portLink):
TypeError: read_details() takes 2 positional arguments but 3 were given


c. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read([(TagName, "SSTRING")], portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



UL1_LOTCODE_STR_X == None 
['2018-11-08 00:05:48.424095', None]


d. Non-Working Python Logic



Note: This works if I put a tag in as the argument with is not a String type within the PLC logic.



python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X"


Output (error)



Traceback (most recent call last):
File "PythonPython36-32librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "PythonPython36-32librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1649, in <module>
sys.exit( main() )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1630, in main
fragment=fragment, printing=printing, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1406, in process
transactions = list( self.results( operations=operations, **kwds ))
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1398, in results
for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1283, in validate
for index,descr,request,reply,status,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state



Other Specs




  • Python: 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]


  • OS: Windows 10









share|improve this question























  • Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
    – Bitcoin Murderous Maniac
    Nov 8 at 5:20










  • The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
    – Bitcoin Murderous Maniac
    Nov 8 at 21:58














up vote
2
down vote

favorite












I have the cpppo Python package installed and I have an ABLogix IO Server with 192.168.1.100 IP that I typically connect to it with different software (not python) as 192.168.1.100,1,0.



My problem is I cannot get it to bring back the value of a tag on an accessible PLC when that tag's data type is set to String in the PLC RSLogix 5000 code. The string value I'm testing with is a 12 character alphanumeric string if that matters so U123HTS76312



My question is to know if someone can see maybe something I'm overlooking that will allow me to get the value from a tag where the PLC has it defined as a String data type?




Note: According to the README.org in the client.connector.get_attribute_single and .get_attributes_all section, it states "To access Get Attribute data with CIP type conversion, use cpppo.server.enip.get_attribute’s proxy classes, instead."



  • I think using for message in source.read([(TagName, "SSTRING")], portLink) in the non-working example "c." below is specifying the CIP
    type but it doesn't work




  • Potential Related Issue: Problem reading/writing STRING data types




    • I get this same error if I try to write a value so that's why I think it may be related.




      python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X=(STRING)123HFGR45678"

      11-08 10:51:47.692 MainThread enip.cli WARNING validate Client Single Write Tag UL1_LOTCODE_STR_X returned non-zero status: Status 255 [8455]
      UL1_LOTCODE_STR_X <= ['123HFGR45678']: 'Status 255 [8455]'






The Context Begins. . .




1. It Works. . .



I have a tag named UL1_TICKETWEIGHT_X which is set as a DINT in the PLC logic that I get the correct sensor data value back from as expected using the below logic.



Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_TICKETWEIGHT_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output



UL1_TICKETWEIGHT_X == 55000 
['2018-11-07 19:59:24.853017', [55000]]



2. It Doesn't Work. . .



I have a tag named UL1_LOTCODE_STR_X which is set as a String in the PLC logic that does not get back the correct data from the sensor with the various things I've tried below to show a few.



I did many other things and read over slews of the code in the files hoping I could figure out which class or method to use or what arguments to pass to what, and so forth.



I have also set the value of UL1_LOTCODE_STR_X to a DINT type value (it is still String type though at PLC level) such as 15 and it still has the same problem



a. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 11, in <module>
for message in source.read(TagName, portLink):
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 431, in read
for val,(sts,(att,typ,uni)) in reader:
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 606, in read_details
depth=self.depth, multiple=self.multiple, timeout=self.timeout )):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state


b. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read_details(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 12, in <module>
for message in source.read_details(TagName, portLink):
TypeError: read_details() takes 2 positional arguments but 3 were given


c. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read([(TagName, "SSTRING")], portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



UL1_LOTCODE_STR_X == None 
['2018-11-08 00:05:48.424095', None]


d. Non-Working Python Logic



Note: This works if I put a tag in as the argument with is not a String type within the PLC logic.



python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X"


Output (error)



Traceback (most recent call last):
File "PythonPython36-32librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "PythonPython36-32librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1649, in <module>
sys.exit( main() )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1630, in main
fragment=fragment, printing=printing, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1406, in process
transactions = list( self.results( operations=operations, **kwds ))
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1398, in results
for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1283, in validate
for index,descr,request,reply,status,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state



Other Specs




  • Python: 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]


  • OS: Windows 10









share|improve this question























  • Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
    – Bitcoin Murderous Maniac
    Nov 8 at 5:20










  • The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
    – Bitcoin Murderous Maniac
    Nov 8 at 21:58












up vote
2
down vote

favorite









up vote
2
down vote

favorite











I have the cpppo Python package installed and I have an ABLogix IO Server with 192.168.1.100 IP that I typically connect to it with different software (not python) as 192.168.1.100,1,0.



My problem is I cannot get it to bring back the value of a tag on an accessible PLC when that tag's data type is set to String in the PLC RSLogix 5000 code. The string value I'm testing with is a 12 character alphanumeric string if that matters so U123HTS76312



My question is to know if someone can see maybe something I'm overlooking that will allow me to get the value from a tag where the PLC has it defined as a String data type?




Note: According to the README.org in the client.connector.get_attribute_single and .get_attributes_all section, it states "To access Get Attribute data with CIP type conversion, use cpppo.server.enip.get_attribute’s proxy classes, instead."



  • I think using for message in source.read([(TagName, "SSTRING")], portLink) in the non-working example "c." below is specifying the CIP
    type but it doesn't work




  • Potential Related Issue: Problem reading/writing STRING data types




    • I get this same error if I try to write a value so that's why I think it may be related.




      python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X=(STRING)123HFGR45678"

      11-08 10:51:47.692 MainThread enip.cli WARNING validate Client Single Write Tag UL1_LOTCODE_STR_X returned non-zero status: Status 255 [8455]
      UL1_LOTCODE_STR_X <= ['123HFGR45678']: 'Status 255 [8455]'






The Context Begins. . .




1. It Works. . .



I have a tag named UL1_TICKETWEIGHT_X which is set as a DINT in the PLC logic that I get the correct sensor data value back from as expected using the below logic.



Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_TICKETWEIGHT_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output



UL1_TICKETWEIGHT_X == 55000 
['2018-11-07 19:59:24.853017', [55000]]



2. It Doesn't Work. . .



I have a tag named UL1_LOTCODE_STR_X which is set as a String in the PLC logic that does not get back the correct data from the sensor with the various things I've tried below to show a few.



I did many other things and read over slews of the code in the files hoping I could figure out which class or method to use or what arguments to pass to what, and so forth.



I have also set the value of UL1_LOTCODE_STR_X to a DINT type value (it is still String type though at PLC level) such as 15 and it still has the same problem



a. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 11, in <module>
for message in source.read(TagName, portLink):
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 431, in read
for val,(sts,(att,typ,uni)) in reader:
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 606, in read_details
depth=self.depth, multiple=self.multiple, timeout=self.timeout )):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state


b. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read_details(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 12, in <module>
for message in source.read_details(TagName, portLink):
TypeError: read_details() takes 2 positional arguments but 3 were given


c. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read([(TagName, "SSTRING")], portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



UL1_LOTCODE_STR_X == None 
['2018-11-08 00:05:48.424095', None]


d. Non-Working Python Logic



Note: This works if I put a tag in as the argument with is not a String type within the PLC logic.



python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X"


Output (error)



Traceback (most recent call last):
File "PythonPython36-32librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "PythonPython36-32librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1649, in <module>
sys.exit( main() )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1630, in main
fragment=fragment, printing=printing, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1406, in process
transactions = list( self.results( operations=operations, **kwds ))
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1398, in results
for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1283, in validate
for index,descr,request,reply,status,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state



Other Specs




  • Python: 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]


  • OS: Windows 10









share|improve this question















I have the cpppo Python package installed and I have an ABLogix IO Server with 192.168.1.100 IP that I typically connect to it with different software (not python) as 192.168.1.100,1,0.



My problem is I cannot get it to bring back the value of a tag on an accessible PLC when that tag's data type is set to String in the PLC RSLogix 5000 code. The string value I'm testing with is a 12 character alphanumeric string if that matters so U123HTS76312



My question is to know if someone can see maybe something I'm overlooking that will allow me to get the value from a tag where the PLC has it defined as a String data type?




Note: According to the README.org in the client.connector.get_attribute_single and .get_attributes_all section, it states "To access Get Attribute data with CIP type conversion, use cpppo.server.enip.get_attribute’s proxy classes, instead."



  • I think using for message in source.read([(TagName, "SSTRING")], portLink) in the non-working example "c." below is specifying the CIP
    type but it doesn't work




  • Potential Related Issue: Problem reading/writing STRING data types




    • I get this same error if I try to write a value so that's why I think it may be related.




      python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X=(STRING)123HFGR45678"

      11-08 10:51:47.692 MainThread enip.cli WARNING validate Client Single Write Tag UL1_LOTCODE_STR_X returned non-zero status: Status 255 [8455]
      UL1_LOTCODE_STR_X <= ['123HFGR45678']: 'Status 255 [8455]'






The Context Begins. . .




1. It Works. . .



I have a tag named UL1_TICKETWEIGHT_X which is set as a DINT in the PLC logic that I get the correct sensor data value back from as expected using the below logic.



Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_TICKETWEIGHT_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output



UL1_TICKETWEIGHT_X == 55000 
['2018-11-07 19:59:24.853017', [55000]]



2. It Doesn't Work. . .



I have a tag named UL1_LOTCODE_STR_X which is set as a String in the PLC logic that does not get back the correct data from the sensor with the various things I've tried below to show a few.



I did many other things and read over slews of the code in the files hoping I could figure out which class or method to use or what arguments to pass to what, and so forth.



I have also set the value of UL1_LOTCODE_STR_X to a DINT type value (it is still String type though at PLC level) such as 15 and it still has the same problem



a. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 11, in <module>
for message in source.read(TagName, portLink):
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 431, in read
for val,(sts,(att,typ,uni)) in reader:
File "PythonPython36-32libsite-packagescppposerverenipget_attribute.py", line 606, in read_details
depth=self.depth, multiple=self.multiple, timeout=self.timeout )):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state


b. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read_details(TagName, portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



Traceback (most recent call last):
File "DesktopTest.py", line 12, in <module>
for message in source.read_details(TagName, portLink):
TypeError: read_details() takes 2 positional arguments but 3 were given


c. Non-Working Python Logic



from cpppo.server.enip.get_attribute import proxy_simple, proxy
from datetime import datetime
import time

TagName = "UL1_LOTCODE_STR_X"
host = "192.168.1.100"
portLink = "route_path = ['link':1,'port':0]"
source = proxy(host)

for message in source.read([(TagName, "SSTRING")], portLink):
val = message
timestr = str(datetime.now())
print([timestr, val])


Output (error)



UL1_LOTCODE_STR_X == None 
['2018-11-08 00:05:48.424095', None]


d. Non-Working Python Logic



Note: This works if I put a tag in as the argument with is not a String type within the PLC logic.



python -m cpppo.server.enip.client -a 192.168.1.100 "UL1_LOTCODE_STR_X"


Output (error)



Traceback (most recent call last):
File "PythonPython36-32librunpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "PythonPython36-32librunpy.py", line 85, in _run_code
exec(code, run_globals)
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1649, in <module>
sys.exit( main() )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1630, in main
fragment=fragment, printing=printing, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1406, in process
transactions = list( self.results( operations=operations, **kwds ))
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1398, in results
for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1393, in operate
for idx,dsc,req,rpy,sts,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1283, in validate
for index,descr,request,reply,status,val in harvested:
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1258, in pipeline
col = next( harvester )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1190, in harvest
issued, self.collect( timeout=timeout )): # must be "lazy" zip!
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 1115, in collect
response,elapsed = await( self, timeout=timeout )
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 872, in await
for response in cli: # if StopIteration raised immediately, defaults to signalling completion
File "PythonPython36-32libsite-packagescppposerverenipclient.py", line 546, in __next__
for mch,sta in engine:
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1226, in delegate
for which,target in submach: # 75% of runtime is spent inside 'run'
File "PythonPython36-32libsite-packagescpppoautomata.py", line 645, in run
source=source, machine=machine, path=path, data=data, ending=ending ):
File "PythonPython36-32libsite-packagescpppoautomata.py", line 1291, in delegate
raise NonTerminal( "%s sub-machine terminated in a non-terminal state" % ( self ))
cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state



Other Specs




  • Python: 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]


  • OS: Windows 10






python python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 21:53

























asked Nov 8 at 5:19









Bitcoin Murderous Maniac

4731516




4731516











  • Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
    – Bitcoin Murderous Maniac
    Nov 8 at 5:20










  • The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
    – Bitcoin Murderous Maniac
    Nov 8 at 21:58
















  • Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
    – Bitcoin Murderous Maniac
    Nov 8 at 5:20










  • The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
    – Bitcoin Murderous Maniac
    Nov 8 at 21:58















Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
– Bitcoin Murderous Maniac
Nov 8 at 5:20




Let me know what I can add to help if I did something wrong please. My goal is to provide everything that's needed so please just tell me if I left something obvious or required out to make this a better question.
– Bitcoin Murderous Maniac
Nov 8 at 5:20












The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
– Bitcoin Murderous Maniac
Nov 8 at 21:58




The error of cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state seems to pop up a lot so not sure if that'd be a helpful pointer for the automata.py file to see if it needs something updated to have the string type for the tag value or what.
– Bitcoin Murderous Maniac
Nov 8 at 21:58

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201953%2fpython-cpppo-wont-display-string-data-type-from-plc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53201953%2fpython-cpppo-wont-display-string-data-type-from-plc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế