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
2
votes
2 answers

How to download FTP file using its full FTP path?

Using the ftplib in Python, you can download files, but it seems you are restricted to use the file name only (not the full file path). The following code successfully downloads the requested code: import…
multigoodverse
  • 7,638
  • 19
  • 64
  • 106
2
votes
2 answers

new line chars added to csv file after ftp.storbinary()

I am attempting to store a csv file on an ftp server using python's ftplib module. Right now, I have about 30 lines of code which generates probabilities of weather values in a 2-d array. I then write this 2-d array to a csv file. When I write…
Charles
  • 187
  • 1
  • 8
2
votes
4 answers

Variable assignments prints out output

Well, when you assign something to a variable in Python: a = 1 nothing visible happens, nothing is printed out. But in this case: import ftplib ftp = ftplib.FTP("igscb.jpl.nasa.gov") ftp.login() a=ftp.retrlines('LIST') When the last line is…
multigoodverse
  • 7,638
  • 19
  • 64
  • 106
2
votes
2 answers

ftplib error while execution

While accessing the remote server through FTP I am getting following error. Not sure whats the problem of it so I can solve. Any lead will be helpful. Code: import ftplib from ftplib import FTP ftp = ftplib.FTP("server_name") Error: Traceback (most…
LonelySoul
  • 1,212
  • 5
  • 18
  • 45
2
votes
1 answer

Python FTPLIB error 530 Permission Denied

I've tried the script below: import os from ftplib import FTP ftp = FTP("ftpsite","myuser", "mypass") ftp.login() ftp.retrlines("LIST") ftp.cwd("folderOne") ftp.cwd("subFolder") listing = [] ftp.retrlines("LIST", listing.append) words =…
lovelyvm
  • 127
  • 2
  • 16
2
votes
1 answer

Python FTP "ERRNO 10054" Sequential File Download

I've written some code to log on to a an AS/400 FTP site, move to a certain directory, and locate files I need to download. It works, but it seems like when there are MANY files to download I receive: socket.error: [Errno 10054] An existing…
Stephen Tetreault
  • 769
  • 1
  • 8
  • 26
2
votes
2 answers

Python ftplib UnicodeEncodeError when trying to upload an XML with unicode content

I am trying to upload an XML with unicode content to a FTP server using ftplib, but getting the following exception when I try to upload the using storbinary method. The XML data is properly encoded to unicode (utf-8), I have made sure of that, I am…
asp
  • 621
  • 8
  • 18
2
votes
3 answers

catch exceptions that caused by connection error in ftplib

I'm trying to upload lots of files using python's ftplib. What kind of exception should I catch to be sure the problem is a connection error (so I can re-connect)? Edit: I tried all_errors in this scenario: Connected to FTP server by ftplib and…
Ariyan
  • 14,760
  • 31
  • 112
  • 175
2
votes
1 answer

Python FTP downloading - Ignore files that already exist in download directory

I have a script that pulls files from a FTP directory on a set interval. However, since the files are only being copied, not moved, it ends up pulling the same files over and over again. What's the best way to ensure that I am only pulling new…
Dryden Long
  • 10,072
  • 2
  • 35
  • 47
2
votes
1 answer

ftplib file select

Manual says To download a file, use ftp.retrlines('RETR ' + filename) Here is what i do: ftp.retrbinary('RETR media/backups/andrey.txt', open("file_to_get.txt", 'a+').write) Could please someone advise how to put filename variable, previously…
user547907
2
votes
2 answers

IOError: [Errno 13] Permission denied - ftplib

I am trying to download files from a ftp server but I am running into an error permission denied error. Traceback (most recent call last): File "/Users/x34/Documents/Python/ftp_download.py", line 27, in download() File…
GeoPy
  • 1,556
  • 3
  • 17
  • 21
2
votes
1 answer

Getting TypeError when trying to download .zip from FTP server

I am trying to download a .zip file from a FTP server and I keep getting this error: File "C:/filename.py", line 37, in handleDownload file.write(block) TypeError: descriptor 'write' requires a 'file' object but received a 'str' Here's my code…
Mark Collier
  • 157
  • 2
  • 3
  • 11
2
votes
2 answers

Is there a way to pickle FTP objects?

I am using Python's multiprocessing to do bulk downloads using FTP. However, when I try to open more than 5 ftp sessions, an EOFError is raised, meaning the host is disconnecting me for opening too many sessions. The only solution I see is to open a…
aensm
  • 3,325
  • 9
  • 34
  • 44
2
votes
0 answers

FtpFindFirstFile get "." on some ftp but actural file on others

When i was testing the following code,i found that "data.cFileName" in "FtpFindFirstFile" was "." on some ftp,and on others,it was an actural file name.In the second case,"InternetFindNextFile" began with the second file.I just want to know why does…
Taurus
  • 73
  • 6
1
vote
2 answers

ftplib connecting error error_proto 150 in python

Im using this code to connect and to get list of directory from a ftp. It works but in some computer I receive ftplib.error_proto: 150. Whats the meaning of this error? Is this error due to anti-virus or permission issues? My os is windows…
unice
  • 2,655
  • 5
  • 43
  • 78