Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fully connect to a MicroLogix1100 in UBUNTU Py3.6.7, but not on an WINDOWS server. #64

Open
lcflorindo opened this issue Mar 10, 2020 · 0 comments

Comments

@lcflorindo
Copy link

lcflorindo commented Mar 10, 2020

Hi, as I said, I was fully able to use pycomm 1.0.8 to read from my MicroLogix1100 on a 3.6.7 Python, but when I tried to deploy/reply into an Windows AWS with same py/libs versions it just doesn't work.
Btw, another thing that I tried is change to a wrong/non-plc ip, and it runs the normal timeout error.

What is the relation about OS? Cause I got a similar error on Linux Suse12 as well... There is any incompatibility about how I code the IP Address or something?

Code:

from pycomm.ab_comm.slc import Driver as SlcDriver
import logging
plc = SlcDriver()
ip = '10.11.12.123'
plc.open(ip)
strr = str(plc.read_tag("N7:0/1"))
plc.close()
print(strr)

Error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
d:\anaconda3\envs\pycaml8\lib\site-packages\pycomm\cip\cip_base.py in build_header(self, command, length)
    616             h = command                                 # Command UINT
--> 617             h += pack_uint(length)                      # Length UINT
    618             h += pack_dint(self._session)                # Session Handle UDINT

TypeError: must be str, not bytes

During handling of the above exception, another exception occurred:

CommError                                 Traceback (most recent call last)
d:\anaconda3\envs\pycaml8\lib\site-packages\pycomm\cip\cip_base.py in open(self, ip_address)
    785                 self.attribs['ip address'] = ip_address
--> 786                 if self.register_session() is None:
    787                     self._status = (13, "Session not registered")

d:\anaconda3\envs\pycaml8\lib\site-packages\pycomm\cip\cip_base.py in register_session(self)
    634         self._session = 0
--> 635         self._message = self.build_header(ENCAPSULATION_COMMAND['register_session'], 4)
    636         self._message += pack_uint(self.attribs['protocol version'])

d:\anaconda3\envs\pycaml8\lib\site-packages\pycomm\cip\cip_base.py in build_header(self, command, length)
    623         except Exception as e:
--> 624             raise CommError(e)
    625 

CommError: must be str, not bytes

During handling of the above exception, another exception occurred:

CommError                                 Traceback (most recent call last)
<ipython-input-1-49a9409fe35c> in <module>
    218             flag = True
    219             while(flag):
--> 220                 plc.open("10.11.12.123")
    221                 string = plc.read_tag("N7:0/1")
    222                 plc.close()

d:\anaconda3\envs\pycaml8\lib\site-packages\pycomm\cip\cip_base.py in open(self, ip_address)
    791             except Exception as e:
    792                 #self.clean_up()
--> 793                 raise CommError(e)
    794 
    795     def close(self):

CommError: must be str, not bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant