# Printing to zebra printer through perspective

**URL:** <https://forum.inductiveautomation.com/t/printing-to-zebra-printer-through-perspective/38090>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 26, 2020, 12:29pm UTC](https://forum.inductiveautomation.com/t/printing-to-zebra-printer-through-perspective/38090 "2020-08-26T12:29:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtr019](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@dtr019](https://forum.inductiveautomation.com/u/dtr019)\
**Post date:** [August 26, 2020, 12:29pm UTC](https://forum.inductiveautomation.com/t/printing-to-zebra-printer-through-perspective/38090/1 "2020-08-26T12:29:21Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 26, 2020, 12:32pm UTC](https://forum.inductiveautomation.com/t/printing-to-zebra-printer-through-perspective/38090/2 "2020-08-26T12:32:07Z")

</div>

Perspective scripts always run on the gateway, not the machine the web browser is viewing the Perspective project on.

Does this change anything for you? It seems maybe you can’t talk to the printer from the gateway machine.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 26, 2020, 12:39pm UTC](https://forum.inductiveautomation.com/t/printing-to-zebra-printer-through-perspective/38090/3 "2020-08-26T12:39:54Z")

</div>

> [@dtr019](#):
>
> Connection refused

Yeah, looks like a firewall in between.
