{"action":"created","issue":{"url":"https://api.github.com/repos/pjkundert/cpppo/issues/14","repository_url":"https://api.github.com/repos/pjkundert/cpppo","labels_url":"https://api.github.com/repos/pjkundert/cpppo/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/pjkundert/cpppo/issues/14/comments","events_url":"https://api.github.com/repos/pjkundert/cpppo/issues/14/events","html_url":"https://github.com/pjkundert/cpppo/issues/14","id":137990656,"number":14,"title":"Too many values to unpack","user":{"login":"karmicthreat","id":1076367,"avatar_url":"https://avatars.githubusercontent.com/u/1076367?v=3","gravatar_id":"","url":"https://api.github.com/users/karmicthreat","html_url":"https://github.com/karmicthreat","followers_url":"https://api.github.com/users/karmicthreat/followers","following_url":"https://api.github.com/users/karmicthreat/following{/other_user}","gists_url":"https://api.github.com/users/karmicthreat/gists{/gist_id}","starred_url":"https://api.github.com/users/karmicthreat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karmicthreat/subscriptions","organizations_url":"https://api.github.com/users/karmicthreat/orgs","repos_url":"https://api.github.com/users/karmicthreat/repos","events_url":"https://api.github.com/users/karmicthreat/events{/privacy}","received_events_url":"https://api.github.com/users/karmicthreat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-02T20:57:54Z","updated_at":"2016-03-07T23:11:43Z","closed_at":null,"body":"So I am trying to read a string that is part of an array of strings out of a AB CompactLogix L18ER.  With the structure JugARecipeName STRING[32] and the DATA tag inside is SINT[82]  so 32 strings with a length of 82.  I get a ValueError: too many values to unpack (expected 2) if I try to read one element.  But I can't seem to read JugARepcipeName[1] or JugARecipeName[1].DATA as I just get 'cpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state' am I doing something wrong to read this? \r\n\r\nExamples below:\r\n\r\npython3 -m cpppo.server.enip.client -a 192.168.2.210 -l cpppo.txt --print 'JugARecipeName[1].DATA'\r\nTraceback (most recent call last):\r\n  File \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 170, in _run_module_as_main\r\n    \"__main__\", mod_spec)\r\n  File \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1609, in <module>\r\n    sys.exit( main() )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1590, in main\r\n    fragment=fragment, printing=printing, timeout=timeout )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1366, in process\r\n    transactions\t\t= list( self.results( operations=operations, **kwds ))\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1358, in results\r\n    for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1353, in operate\r\n    for idx,dsc,req,rpy,sts,val in harvested:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1243, in validate\r\n    for index,descr,request,reply,status,val in harvested:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1218, in pipeline\r\n    col\t\t= next( harvester )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1150, in harvest\r\n    issued, self.collect( timeout=timeout )): # must be \"lazy\" zip!\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1075, in collect\r\n    response,elapsed\t= await( self, timeout=timeout )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 832, in await\r\n    for response in cli: # if StopIteration raised immediately, defaults to {} signalling completion\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 509, in __next__\r\n    for mch,sta in engine:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 645, in run\r\n    source=source, machine=machine, path=path, data=data, ending=ending ):\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 1226, in delegate\r\n    for which,target in submach: # 75% of runtime is spent inside 'run'\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 645, in run\r\n    source=source, machine=machine, path=path, data=data, ending=ending ):\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 1226, in delegate\r\n    for which,target in submach: # 75% of runtime is spent inside 'run'\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 645, in run\r\n    source=source, machine=machine, path=path, data=data, ending=ending ):\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/automata.py\", line 1291, in delegate\r\n    raise NonTerminal( \"%s sub-machine terminated in a non-terminal state\" % ( self ))\r\ncpppo.automata.NonTerminal: ( data.( select.((noop)) ) ) sub-machine terminated in a non-terminal state\r\n\r\n---------------------------------------------\r\n\r\npython3 -m cpppo.server.enip.client -a 192.168.2.210 -l cpppo.txt --print 'JugARecipeName[1].DATA[0]'\r\n\r\nTraceback (most recent call last):\r\n  File \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 170, in _run_module_as_main\r\n    \"__main__\", mod_spec)\r\n  File \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1609, in <module>\r\n    sys.exit( main() )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1590, in main\r\n    fragment=fragment, printing=printing, timeout=timeout )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1366, in process\r\n    transactions\t\t= list( self.results( operations=operations, **kwds ))\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1358, in results\r\n    for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds ):\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1353, in operate\r\n    for idx,dsc,req,rpy,sts,val in harvested:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1243, in validate\r\n    for index,descr,request,reply,status,val in harvested:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 1208, in pipeline\r\n    iss\t\t= next( issuer )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 932, in issue\r\n    for op in operations:\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line 205, in parse_operations\r\n    seg,elm,cnt\t\t= parse_path_elements( tag )\r\n  File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/device.py\", line 314, in parse_path_elements\r\n    elm,_\t\t= elm.split( ']' )\r\nValueError: too many values to unpack (expected 2)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/pjkundert/cpppo/issues/comments/193497671","html_url":"https://github.com/pjkundert/cpppo/issues/14#issuecomment-193497671","issue_url":"https://api.github.com/repos/pjkundert/cpppo/issues/14","id":193497671,"user":{"login":"datasim","id":6362801,"avatar_url":"https://avatars.githubusercontent.com/u/6362801?v=3","gravatar_id":"","url":"https://api.github.com/users/datasim","html_url":"https://github.com/datasim","followers_url":"https://api.github.com/users/datasim/followers","following_url":"https://api.github.com/users/datasim/following{/other_user}","gists_url":"https://api.github.com/users/datasim/gists{/gist_id}","starred_url":"https://api.github.com/users/datasim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datasim/subscriptions","organizations_url":"https://api.github.com/users/datasim/orgs","repos_url":"https://api.github.com/users/datasim/repos","events_url":"https://api.github.com/users/datasim/events{/privacy}","received_events_url":"https://api.github.com/users/datasim/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T23:11:43Z","updated_at":"2016-03-07T23:11:43Z","body":"If you clone https://github.com/pjkundert/cpppo.git, and 'git checkout\nfeature-paths', I've now implemented (hopefully) more complete handling of\nmore complex paths.   If you 'python setup.py install' it, let me know if\nit handles your paths better...\n\n--\n    -pjk\n\n\nOn Thu, Mar 3, 2016 at 12:33 PM, Richard Nienhuis <notifications@github.com>\nwrote:\n\n> Example below, directly defining the EPATH does work for me:\n> python3 -m cpppo.server.enip.client -a 192.168.2.210 --print\n> '@{\"symbolic\":\"JugARecipeName\"}/{\"element\":5}/{\"symbolic\":\"DATA\"}/{\"element\":1}'\n> JugARecipeName.DATA[1][ 1-1 ]+ 0 == [80]: 'OK'\n>\n> Verbose example from previous:\n> python3 -m cpppo.server.enip.client -a 192.168.2.210 --print -vvv\n> 'JugARecipeName[1].DATA[1]'\n> 03-03 14:18:39.361 MainThread enip.cli DETAIL *init* Connect: TCP/IP to\n> ('192.168.2.210', 44818)\n> 03-03 14:18:39.391 MainThread enip.cli DETAIL cip_send Client CIP Send: {\n> \"enip.options\": 0,\n> \"enip.CIP.register.options\": 0,\n> \"enip.CIP.register.protocol_version\": 1,\n> \"enip.sender_context.input\":\n> \"bytearray(b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00')\",\n> \"enip.status\": 0,\n> \"enip.session_handle\": 0\n> }\n> 03-03 14:18:39.391 MainThread enip.cli INFO cip_send EtherNet/IP: 24 +\n> CIP: 4 == 28 bytes total\n> 03-03 14:18:39.391 MainThread enip.cli INFO send EtherNet/IP-->\n> 192.168.2.210:44818 send 28:\n> b'e\\x00\\x04\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00'\n> 03-03 14:18:39.392 MainThread enip.cli INFO *next* EtherNet/IP-->\n> 192.168.2.210:44818 rcvd 0: None\n> 03-03 14:18:39.398 MainThread enip.cli INFO *next* EtherNet/IP-->\n> 192.168.2.210:44818 rcvd 28:\n> b'e\\x00\\x04\\x00\\x01\\x00\\x0b\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00'\n> 03-03 14:18:39.402 MainThread cpppo INFO terminate ( header.(\n> command.((byte)) : => enip.command = 101 (format b' 03-03 14:18:39.403\n> MainThread cpppo INFO terminate ( header.( command.((byte)) : =>\n> enip.length = 4 (format b' 03-03 14:18:39.403 MainThread cpppo INFO\n> terminate ( header.( command.((byte)) : => enip.session_handle = 720897\n> (format b' 03-03 14:18:39.403 MainThread cpppo INFO terminate ( header.(\n> command.((byte)) : => enip.status = 0 (format b' 03-03 14:18:39.404\n> MainThread cpppo INFO terminate ( header.( command.((byte)) : =>\n> enip.options = 0 (format b' 03-03 14:18:39.404 MainThread enip.cli INFO\n> __next__ EtherNet/IP 192.168.2.210:44818 done: ((enip.((payload.((byte)))\n> -> ((payload.; next byte 28: None : {'enip': {'options': 0, 'command': 101,\n> 'status': 0, 'session_handle': 720897, 'input': array('B', [1, 0, 0, 0]),\n> 'length': 4, 'sender_context': {'input': array('B', [0, 0, 0, 0, 0, 0, 0,\n> 0])}}, 'peer': ('192.168.2.210', 44818)}\n> 03-03 14:18:39.406 MainThread cpppo INFO run ( register.(\n> protocol_version.((byte)) -- limit='enip.CIP.register...length' == 4;\n> ending at symbol 4 vs. None\n> 03-03 14:18:39.406 MainThread cpppo INFO terminate ( register.(\n> protocol_version.((byte)) : => enip.CIP.register.protocol_version = 1\n> (format b' 03-03 14:18:39.406 MainThread cpppo INFO terminate ( register.(\n> protocol_version.((byte)) : => enip.CIP.register.options = 0 (format b'\n> 03-03 14:18:39.406 MainThread enip.cli INFO __next__ Returning result:\n> {'enip': {'options': 0, 'command': 101, 'status': 0, 'session_handle':\n> 720897, 'input': array('B', [1, 0, 0, 0]), 'CIP': {'register': {'options':\n> 0, 'protocol_version': 1}}, 'length': 4, 'sender_context': {'input':\n> array('B', [0, 0, 0, 0, 0, 0, 0, 0])}}, 'peer': ('192.168.2.210', 44818)}\n> 03-03 14:18:39.415 MainThread enip.cli NORMAL __init__ Connect: Success in\n> 0.054s/ 5.000s\n> 03-03 14:18:39.415 MainThread enip.cli DETAIL main Client Register Rcvd\n> 0.055/ 5.000s\n> Traceback (most recent call last):\n> File\n> \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\",\n> line 170, in _run_module_as_main\n> \"__main__\", mod_spec)\n> File\n> \"/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py\",\n> line 85, in _run_code\n> exec(code, run_globals)\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1609, in\n> sys.exit( main() )\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1590, in main\n> fragment=fragment, printing=printing, timeout=timeout )\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1366, in process\n> transactions = list( self.results( operations=operations, *\n>\n> *kwds )) File\n> \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\", line\n> 1358, in results for idx,dsc,req,rpy,sts,val in self.operate( operations, **kwds\n> ):\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1353, in operate\n> for idx,dsc,req,rpy,sts,val in harvested:\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1243, in validate\n> for index,descr,request,reply,status,val in harvested:\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 1208, in pipeline\n> iss = next( issuer )\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 932, in issue\n> for op in operations:\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/client.py\",\n> line 205, in parse_operations\n> seg,elm,cnt = parse_path_elements( tag )\n> File \"/usr/local/lib/python3.5/site-packages/cpppo/server/enip/device.py\",\n> line 314, in parse_path_elements\n> elm,_ = elm.split( ']' )\n> ValueError: too many values to unpack (expected 2)\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/pjkundert/cpppo/issues/14#issuecomment-191927460>.\n>\n"}}