Questions tagged [ftplib]

ftplib — FTP protocol client under Python programming language

ftplib is a python module which defines the class FTP and a few related items.

The FTP class implements the client side of the FTP protocol. You can use this to write Python programs that perform a variety of automated FTP jobs, such as mirroring other ftp servers. It is also used by the module urllib.request to handle URLs that use FTP. For more information on FTP (File Transfer Protocol), see Internet RFC 959.

Read more about ftplib at python docs..

681 questions
3
votes
2 answers

What can I do to improve socket performance in Python 3?

Initial Post I have a very long running program where about 97% of the performance is tied up in socket objects created by ftp.retrlines and ftp.retrbinary calls. I have already used processes and threads to parallelize the program. Is there…
user12345678
  • 429
  • 1
  • 4
  • 10
3
votes
3 answers

Get folder size using FtpLib

I'm using FtpLib (Python) to download a folder with files from an ftp server. But I want to know the size of the folder before I start downloading it. In the documentation I found FTP.size(filename) but that's just for files and not for folders... I…
Frederik Voordeckers
  • 1,321
  • 15
  • 31
3
votes
0 answers

How do I read a text file on an FTP server in Python

I have a text file in an FTP server. How would I be able to open this file directly on the server? I have the following and I am able to log in, but I know something is wrong with how I am opening the file. I'm a huge Python noob, so I apologize if…
Joe Knupp
  • 31
  • 1
  • 3
3
votes
2 answers

Uploads via ftplib in python taking signicantly longer than doing it manually

SO, For some reason the little bit of code below is taking SIGNIFICANTLY longer to upload than if I was to upload via a FTP program or via the website itself. The files come to 600kb which via ftp programs/directly via the web takes 1-3 seconds max…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
3
votes
0 answers

Copy files in ftp server Python

I was able to copy files in the ftp server to a different location by writing the file to the webserver and then uploading it again. Is there any way that I can write the file contents to memory without writing it to the harddisk and uploading them…
user2527177
  • 55
  • 1
  • 5
3
votes
2 answers

Using FTPlib to upload a 200kb html page

I'm using the following code to upload a html file to my website however when uploading it seems to be missing some data... My content is 1930 lines with a "length" of 298872 (I guess that's how many characters) ## Login using the ftplib library and…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
3
votes
1 answer

530 Error authenticating with ftplib

Hello there everyone! I am trying to write a script to automate various mundane tasks involved with my FTP server. I was planning on using ftplib to connect and interface with the FTP server, but I am having some issues connecting to the server as…
Michael Fryer
  • 349
  • 1
  • 5
  • 14
3
votes
2 answers

How to transfer a file between two FTP servers?

I have two ftp servers with fxp enabled on both, I'm just wondering how I would transfer a file between the two servers in Python? I was told curl wouldnt do it, but maybe ftplib will do. so, the file (file.txt) is in '/personal/' FTP1 and I want to…
jack
  • 33
  • 3
3
votes
2 answers

Multiprocessing FTP Uploading With A Precise Number of Connections

So, I've been able to use multiprocessing to upload multiple files at once to a given server with the following two functions: import ftplib,multiprocessing,subprocess def upload(t): …
user
  • 555
  • 3
  • 6
  • 21
3
votes
2 answers

ftplib: Passive & NAT/address translation

Is there a way to detect that the server returns its private network address when entering passive mode, and to translate it into its public address? I don't have access to the server. >>> # Python 2.7.3rc2 >>> from ftplib import FTP_TLS >>> ftps =…
Pascal Polleunus
  • 2,411
  • 2
  • 28
  • 30
3
votes
1 answer

ftplib: socket.error during/after LIST // ssl._sslobj.shutdown() / connection timed out

I try to connect to a FTPS server using a client certificate. I tried on 2 different servers (over which I've no control but that should be quite similar). The connection is established and the PWD command succeeds. On one server the LIST command…
Pascal Polleunus
  • 2,411
  • 2
  • 28
  • 30
3
votes
1 answer

Python ftplib - retrbinary fails with timeout for zero byte files

Using Python 2.6 and downloading files from an FTP server in passive mode, I found that retrbinary fails with a timeout if the source file is empty (0 bytes). Is this a bug or am I missing a configuration option? ftp.retrbinary('RETR digital.conf',…
Bruce Alport
  • 432
  • 5
  • 12
3
votes
1 answer

Python ftplib: Best way to check if a file has changed?

I'm looking to schedule FTP file transfers, but to conserve bandwidth, I would like to only upload files that have changed. What's a good reliable way to do this that will work on a variety of different hosting providers?
zer0stimulus
  • 22,306
  • 30
  • 110
  • 141
2
votes
1 answer

ftplib callbacks not working - Python 3

I have looked everywhere and cannot find a fix for this problem, ftplib storbinary callbacks. This is my first time using callbacks so it could be something stupid, I have some code which should call my function everytime 8192 bytes are uploaded I…
CallumA
  • 92
  • 1
  • 3
  • 7
2
votes
1 answer

Ignore ftplib's 550 error when file does not exist and and continue with other files

I have problem with ignoring an error and just going on with other commands. The code below is checking if file exists (using FTP.size) and prints message if so. And - here is problem. When it doesn't find file in this main directory, it should go…
michalb93
  • 119
  • 9