Hello, I'm using the firmware 2022.0.3 LTS on an AXC F 2152. I successfully installed the PyPlcnextRsc package. I imported the required modules. I built the login configuration. But device. connect() creates these errors: admin@axcf2152:~$ python3 Python 3.8.11 (default, Jun 28 2021, 10:57:31) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from PyPlcnextRsc import Device, RscVariant, RscType >>> from PyPlcnextRsc.Arp.Plc.Gds.Services import IDataAccessService, WriteItem >>> secureInfoSupplier = lambda:("admin","password") >>> device = Device('127.0.0.1', secureInfoSupplier=secureInfoSupplier) :1: FutureWarning: CURRENT ONLY FOR INTERNAL TEST USE !!! >>> device.connect() Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/PyPlcnextRsc/common/transport/rsc_sock. py", line 178, in connect self._socket.connect(self.info.getAddr()) File "/usr/lib/python3.8/ssl.py", line 1342, in connect self._real_connect(addr, False) File "/usr/lib/python3.8/ssl.py", line 1333, in _real_connect self.do_handshake() File "/usr/lib/python3.8/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1131) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.8/site-packages/PyPlcnextRsc/common/device.py", line 179, in connect self._rscClient.connect() File "/usr/lib/python3.8/site-packages/PyPlcnextRsc/common/transport/rsc_client.py", line 85, in connect self.socketWrapper.connect() File "/usr/lib/python3.8/site-packages/PyPlcnextRsc/common/transport/rsc_sock.py", line 184, in connect raise CommonRemotingException(message="Can not connect to device", cause=e, err=ErrType.SOCKET_UNSPECIFIED) PyPlcnextRsc.common.exceptions.CommonRemotingException: ('Can not connect to device (SOCKET_UNSPECIFIED)', SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1131)')) What is missing? Many thanks Götz (Goetz.Jaeckel@GJ-Didaktik.de)
Dear Mr. Jäckel, I’ve just encountered the same error, when using the latest firmware 2022.0.3 LTS. However, it worked with the firmware 2021.9. Probably some security mechanisms have changed since the error indicates an incompatible TLS version. As a first workaround I would recommend downgrading the firmware. Since I was not involved in the development of the Python library, I could not fix the error. Nevertheless, I will contact my colleague who developed the library and ask for support. When I get news, I will inform you via this channel. Hope that helps. If you have further questions don’t hesitate to contact me. Best regards Nils Hettig
Hi, We have a customer that is interested in using this solution to read/write datas on the PLC, but he also needs a specific package for his Python application, which doesn't work on our Linux distribution. We told him he could use a Docker container, so I tried to use this package inside a container but there are some issues : root@dc0cbfda6a0b:/opt# python3 test_docker.py /opt/test_docker.py:11: FutureWarning: CURRENT ONLY FOR INTERNAL TEST USE !!! device = Device('192.168.254.52', secureInfoSupplier=secureInfoSupplier) Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/PyPlcnextRsc/common/transport/rsc_sock.py", line 178, in connect self._socket.connect(self.info.getAddr()) File "/usr/local/lib/python3.10/ssl.py", line 1374, in connect self._real_connect(addr, False) File "/usr/local/lib/python3.10/ssl.py", line 1365, in _real_connect self.do_handshake() File "/usr/local/lib/python3.10/ssl.py", line 1341, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: NO_CIPHERS_AVAILABLE] no ciphers available (_ssl.c:997) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/test_docker.py", line 12, in device.connect() File "/usr/local/lib/python3.10/site-packages/PyPlcnextRsc/common/device.py", line 179, in connect self._rscClient.connect() File "/usr/local/lib/python3.10/site-packages/PyPlcnextRsc/common/transport/rsc_client.py", line 85, in connect self.socketWrapper.connect() File "/usr/local/lib/python3.10/site-packages/PyPlcnextRsc/common/transport/rsc_sock.py", line 184, in connect raise CommonRemotingException(message="Can not connect to device", cause=e, err=ErrType.SOCKET_UNSPECIFIED) PyPlcnextRsc.common.exceptions.CommonRemotingException: ('Can not connect to device (SOCKET_UNSPECIFIED)', SSLError(1, '[SSL: NO_CIPHERS_AVAILABLE] no ciphers available (_ssl.c:997)')) The docker container is the official Python image with the latest tag. If you need more information, feel free to ask, Cheers,
Thanks Gentlemen, it works!
Hi. I'm using the axc f 2152 controller with frimware 2023.6.0. I used this example to read/write to the PLC via the commandprompt and ssh. This works fine. I wanted to use the PBCL_SysLinuxShell from the PLCnextBase library to call the script so I don't have to manually copy it in terminal.When I execute it, the functionblock says it's busy and it stays busy. I dont'get a confirmation it's done nor a result. I ran the script line by line and it seems to be stuck at "device.connect()". Any idea why it won't connect when using this FB? Below you can find the pythoncode I use. Many thanks. from PyPlcnextRsc import Device, RscVariant, RscType from PyPlcnextRsc.Arp.Plc.Gds.Services import IDataAccessService, WriteItem secureInfoSupplier = lambda:("admin","password") device = Device('192.168.0.10', secureInfoSupplier=secureInfoSupplier) device.connect() data_access_service = IDataAccessService(device) read_item = data_access_service.ReadSingle("Arp.Plc.Eclr/rScaled") value = read_item.Value.GetValue() print (value)
I note that this question was also asked in the PLCnext Community Forum, where an answer was given by the developers of the PLCnextBase library.
Leave a Reply
You must be logged in to post a comment.