# Send command to cab PX4L/300 printer Labels

**URL:** <https://forum.inductiveautomation.com/t/send-command-to-cab-px4l-300-printer-labels/10973>\
**Category:** Ignition\
**Created:** [December 31, 2015, 6:36pm UTC](https://forum.inductiveautomation.com/t/send-command-to-cab-px4l-300-printer-labels/10973 "2015-12-31T18:36:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lgarcia](https://avatars.discourse-cdn.com/v4/letter/l/a87d85/32.png) [@lgarcia](https://forum.inductiveautomation.com/u/lgarcia)\
**Post date:** [December 31, 2015, 6:36pm UTC](https://forum.inductiveautomation.com/t/send-command-to-cab-px4l-300-printer-labels/10973/1 "2015-12-31T18:36:29Z")

</div>

I’m triyng to use the code on the link bellow but it doesn’t work’s.  
[inductiveautomation.com/forum/v … =70&t=9727](https://inductiveautomation.com/forum/viewtopic.php?f=70&t=9727)  
I have a cab PX4L \300 Printer to print Labels.

You can see my code bellow:

#========================================================================================

# cab PX4L/300 commands

#========================================================================================  
strMessage = “t0/n/r”

#========================================================================================

# Import Socket Library

#========================================================================================  
import socket  
#========================================================================================

# Get Printer IP

#========================================================================================  
strIP=‘10.11.91.33’  
#========================================================================================

# Send Data to Printer

#========================================================================================  
port=9100  
try:  
# Open Socket Connection  
clientSocket=Socket(strIP,port)  
#Open data output stream  
outToPrinter=DataOutputStream(clientSocket.getOutputStream())  
#Send Data to Printer  
outToPrinter.write(strMessage)  
#close data stream and socket  
outToPrinter.close();  
clientSocket.close();  
except IOError:  
print “Error”

Please, check the message that appears:  
Traceback (most recent call last):

File “event:mouseClicked”, line 21, in

File “event:mouseClicked”, line 21, in

NameError: name ‘Socket’ is not defined

Ignition v7.7.4 (b2015033012)  
Java: Oracle Corporation 1.8.0\_65

I don’t know how can I solve that problem. Could you help me???  
Regards,  
Leandro

---

<div class="post-metadata">

**Author:** ![uhalt](https://avatars.discourse-cdn.com/v4/letter/u/6bbea6/32.png) [@uhalt](https://forum.inductiveautomation.com/u/uhalt)\
**Post date:** [January 7, 2016, 8:16pm UTC](https://forum.inductiveautomation.com/t/send-command-to-cab-px4l-300-printer-labels/10973/2 "2016-01-07T20:16:50Z")

</div>

“Socket” is not defined because the Library is called “socket”, case sensitive.
