473,569 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i have error then use ftplib

Hello!
I use this code:

from ftplib import FTP
def handleDownload( block):
file.write(bloc k)
print "."

file = open('1', 'wb')
ftp = FTP('ftp.utk.ru ')
ftp.set_pasv(1)
ftp.login()
ftp.retrlines(' LIST')
ftp.cwd('users/video/Anime/Beyond the Clouds')
ftp.retrbinary( 'RETR "[Triad]_Beyond_the_Clo uds_CD1.srt"', handleDownload, 1024, 600 )

ftp.quit()
file.close()
and have this error message.

Traceback (most recent call last):
File "ftp.py", line 10, in ?
ftp.retrlines(' LIST')
File "C:\Python24\li b\ftplib.py", line 396, in retrlines
conn = self.transfercm d(cmd)
File "C:\Python24\li b\ftplib.py", line 345, in transfercmd
return self.ntransferc md(cmd, rest)[0]
File "C:\Python24\li b\ftplib.py", line 324, in ntransfercmd
conn.connect(sa )
File "<string>", line 1, in connect
socket.error: (10065, 'No route to host')
Programs that not use Python connect to the server ok.
Where I do mistake?

Best regards
nazarianin

Mar 30 '06 #1
1 2985
Hello nazarianin,

On 2006-03-30 09:35, 5>=>2 ;5:A59 wrote:
from ftplib import FTP
def handleDownload( block):
file.write(bloc k)
print "."

file = open('1', 'wb')
ftp = FTP('ftp.utk.ru ')
ftp.set_pasv(1)
ftp.login()
ftp.retrlines(' LIST')
[...] and have this error message.

Traceback (most recent call last):
File "ftp.py", line 10, in ?
ftp.retrlines(' LIST')
[...]
socket.error: (10065, 'No route to host')

Programs that not use Python connect to the server ok.
Where I do mistake?


Are you sure that you don't need user and password arguments in
..login()? The documentation on ftplib says:

login([user[, passwd[, acct]]])
Log in as the given user. The passwd and acct parameters are
optional and default to the empty string. If no user is
specified, it defaults to 'anonymous'. If user is
'anonymous', the default passwd is 'anonymous@'. This
function should be called only once for each instance, after
a connection has been established; it should not be called at
all if a host and user were given when the instance was
created. Most FTP commands are only allowed after the client
has logged in.

Perhaps the server wasn't satisfied with your credentials and
closed the connection between the .login() and .retrlines()
calls?

Stefan
Mar 30 '06 #2

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

Similar topics

3
19827
by: python | last post by:
Hi: I want to write a procedure to automatically upload some files for me, but I'm getting stuck. Before I write my own gruesome put() function, I wanted to check if there is an easier way. Here's what I can do so far: >>>import ftplib >>>conn = ftplib.FTP('ftp.example.com') >>>conn.login(user='userid', passwd='passwd')
5
7824
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of files via FTP. I'm using ftplib to do it, and for each file I'm using transfercmd("STOR " + myfile) to get the socket, then uploading 4096 bytes at...
0
2115
by: Joshua Burvill | last post by:
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 ?
2
2941
by: Matija Papec | last post by:
I would like to reimplement ftplib "nlst" using ftplib.dir (ftp server doesn't support nlst) so I'm trying to guess how to use ftp callbacks. Any help is appreciated. tia! ============ #!/usr/bin/python # nlst vs list
1
4432
by: Tim G. | last post by:
I am trying to use Win Python to ftp files from an AS/400 IFS directory down to my Windows machine. I seem to get stuck when I am trying to send a command to the AS/400 to switch file systems from native to IFS and then to issue a cd to my folder. I get the error below. If anyone has had experience trying to ftp from a 400, I would...
0
1722
by: Ajay Abhyankar | last post by:
Hi, I am trying to upload zip files using ftplib module. The server has Vsftpd 2.0.3 installed on it. I was able to succesfully upload files using ftplib and Vsftpd on the server locally connected. Now, I want to transfer files to remote server using the same script. I am getting the following error: Traceback (most recent call last):...
0
1425
by: Tarun Kapoor | last post by:
------- Code ------ remotepath = "/incoming" f = FTP(host) f.login(username,password) f.cwd(remotepath) localfile ="C:\\test.txt"
6
5767
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 sometimes seem to be non- fatal, and other times the transfer does not complete. I've debugged the hell out of the code, and can't figure out what is...
1
6060
by: loial | last post by:
Trying to use ftplib.FTP.nlst() method to list the files in a directory on a FTP server. It works fine except when there are no files in the directory. Then it gives the error ftplib.error_perm: 550 No files found. How can I handle this cleanly?
0
7701
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.