Hi,
We moved a project from vision to perspective which had a label printing button, the script is working fine in vision and in script console but giving an error when running in perspective. Here’s the script and the subsequent error.
import socket
HOST = "10.177.39.110"
PORT = 9100
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
Dcs_label_1 = """
^XA
^FO680,53^BY4.5,2.5^B3R,N,100,N,N^FD5410014909^FS
^FO600,375^A0R,50,70^FD5410014909^FS
^FO520,53^A0R,50,70^FD5410-01-490-9^FS
^FO440,53^A0R,50,70^FDCAGE 559^FS
^FO360,53^A0R,50,70^FD17-2-0979-1^FS
^FO280,53^A0R,50,70^FDCONNECTOR^FS
^FO200,53^A0R,50,70^FD1 EA^FS
^FO120,53^A0R,50,70^FDSPRDL1-19-P-0272^FS
^FO40,53^A0R,50,70^FDM 10^FS
^FO40,700^A0R,50,70^FD%(Date)s^FS
^PQ1^XZ
EOL
""" % {"Date":system.date.format(system.date.now(),"YYYY/MM/dd")}
s.sendall(Dcs_label_1)
s.close()
Error running action 'dom.onClick' on Desktop/Receiving_Label@D/root/Button: Traceback (most recent call last): File " ", line 6, in runAction File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 1441, in meth return getattr(self._sock,name)(*args) File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 935, in connect self._connect(addr) File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 911, in _connect self._handle_channel_future(self.connect_future, "connect") File "C:\Program Files\Inductive Automation\Ignition\user-lib\pylib\_socket.py", line 384, in handle_exception raise _map_exception(jlx) _socket.error: [Errno 10061] Connection refused
thank you.