Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Sending file to print server using ftplib

Reply
Thread Tools

Sending file to print server using ftplib

 
 
Joshua Burvill
Guest
Posts: n/a
 
      05-20-2004
Hello,

I am trying to print something to a print server using the following
function
but I get errors, does anyone have any pointers?

Rgds, Josh

Traceback (most recent call last):
File "<pyshell#2>", line 1, in ?
mk_zeb_label()
File "\\mrisydney\ZopeBBAp\Extensions\mk_zeb_label. py", line 38, in
mk_zeb_label
val=ftp.storlines("STOR " + portname, file_handle)
File "C:\Python21\lib\ftplib.py", line 382, in storlines
conn = self.transfercmd(cmd)
File "C:\Python21\lib\ftplib.py", line 296, in transfercmd
return self.ntransfercmd(cmd, rest)[0]
File "C:\Python21\lib\ftplib.py", line 273, in ntransfercmd
host, port = parse227(self.sendcmd('PASV'))
File "C:\Python21\lib\ftplib.py", line 229, in sendcmd
return self.getresp()
File "C:\Python21\lib\ftplib.py", line 202, in getresp
raise error_perm, resp
error_perm: 501 command not supported.

########################
## 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.15"
portname="COM1"
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("","")

val=ftp.storlines("STOR " + portname, file_handle)

return val


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get file name on a remote server with ftplib? alex Python 3 01-08-2007 10:15 AM
ftplib - file.write, file.close() - verify finished writing locally before delete source? Peter A. Schott Python 0 02-10-2005 10:22 PM
ftplib help - delete from server after download results in 0-byte file Peter A. Schott Python 0 02-01-2005 10:53 PM
Re: How to connect to ftp server via proxy using ftplib???? Tim Williams Python 0 10-20-2004 10:46 AM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments