473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Sending file to print server using ftplib

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
Jul 18 '05 #1
0 2103

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Limey Drink | last post by:
Hi all, Firstly :-) , is there any where I can search through archived newsgroup posts so I am not cluttering up the newsgroup with repeated queries ? And secondly :-), I know this has...
2
by: Joshua Burvill | last post by:
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...
5
by: [ EuGeNe ] | last post by:
Hi all, I would like to write a script that downloads one file from a ftp server if the file creation date satisfy a condition. I can't figure out how to find from a ftp server what is the...
0
by: Peter A. Schott | last post by:
Got a strange scenario going on here in that I could have sworn this worked yesterday. I am issuing binary retrieval calls to an FTP server, writing to a file, close the file, then removing the...
1
by: Robert | last post by:
I just tried to convert a (hugh size) ftp.retrbinary run into a pseudo-file object with .read(bytes) method in order to not consume 500MB on a copy operation. First I thought, its easy as usual...
0
by: Ahmed, Shakir | last post by:
HI Group, As I am very new in python field so this question might be very silly to you but if I get any help is highly appreciated. Problem: I wrote a python script which is working fine...
0
by: Tarun Kapoor | last post by:
------- Code ------ remotepath = "/incoming" f = FTP(host) f.login(username,password) f.cwd(remotepath) localfile ="C:\\test.txt"
6
by: half.italian | last post by:
Hi all, I'm using ftplib to transfer large files to remote sites. The process seems to work perfectly with small files, but when the file gets to large ~20GB I begin getting errors that...
2
by: skulka3 | last post by:
Hello, I want to implement file downloads inside an authenticated web page, such that when a user clicks a link, the server side python code connects to a ftp server, downloads a relevant file...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.