J
Joshua Burvill
Hello,
I have the following script for printing something to a print server using
ftplib, but it seems that I have a problem with putting the content into the
file object as is shown by the following output from the script.
Any tips?
-Josh
########################
## SCRIPT STARTS HERE ##
########################
def mk_zeb_label():
from ftplib import FTP
import string, cStringIO
## Create file-handle to a "file-like" string
file_handle=cStringIO.StringIO()
printserver_ip="192.168.2.177"
portname="COM"
zpt_code="""
^XA
^cfd,36,20
^by3,,50
^fo470,50
^abn,48,30^fdREPAIR^fs
^fo50,150
^fdSome text goes here.^fs
^fdSome text goes here.^fs
^fdSome text goes here.^fs
^fo50,50
^bc^fd114567^fs
^XZ
"""
file_handle.write(zpt_code)
ftp=FTP(printserver_ip)
ftp.login("","")
ftp.set_pasv(0)
val=ftp.storlines("STOR " + portname, file_handle)
return val, file_handle.read()
I have the following script for printing something to a print server using
ftplib, but it seems that I have a problem with putting the content into the
file object as is shown by the following output from the script.
Any tips?
-Josh
########################
## SCRIPT STARTS HERE ##
########################
def mk_zeb_label():
from ftplib import FTP
import string, cStringIO
## Create file-handle to a "file-like" string
file_handle=cStringIO.StringIO()
printserver_ip="192.168.2.177"
portname="COM"
zpt_code="""
^XA
^cfd,36,20
^by3,,50
^fo470,50
^abn,48,30^fdREPAIR^fs
^fo50,150
^fdSome text goes here.^fs
^fdSome text goes here.^fs
^fdSome text goes here.^fs
^fo50,50
^bc^fd114567^fs
^XZ
"""
file_handle.write(zpt_code)
ftp=FTP(printserver_ip)
ftp.login("","")
ftp.set_pasv(0)
val=ftp.storlines("STOR " + portname, file_handle)
return val, file_handle.read()