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

How to Prevent Overwriting a Existing File Using FTPLIB in Python?

I made a python program which stores the user entered data in a sqlite database. I want to upload it to ftp server. I tried using ftplib in python. Here, database file name is same for all the users who uses the program. Here, my problem is If user1…
gwthm.in
  • 638
  • 9
  • 24
0
votes
0 answers

Download a file from ftp using ftplib

I am looking for a specific file within a folder on FTP. There are several folders and my code loops through each folder to find the file. Once, I find the file I would like to download it. import ftplib import os, sys, os.path ftp =…
0
votes
1 answer

Seemingly Random errors in writing with retrbinrary()

I'm trying to download a text file from an ftp server and its working, however when I was doing a sense check on the data it seems to randomly miss-read the data and write two lines when I am expecting one, example: DYO8 6 GB1925 5 20582 DYO8…
ashcanschool
  • 319
  • 3
  • 18
0
votes
3 answers

IOError opening an existing file with Python

Running the following code: import os import datetime import ftplib currdate = datetime.datetime.now() formatdate = currdate.strftime("%m-%d-%Y %H%M") def log(): fqn = os.uname()[1] ext_ip =…
cit
  • 2,465
  • 5
  • 28
  • 36
0
votes
1 answer

Using configparser and ftplib caused error

this code section in main() causes the problem: config = configparser.ConfigParser() config.read('config.ini') ftp = ftplib.FTP("ftp.mommy.de") username = config.get('Ftp','username') print(username) ftp.login(username,…
Benjamin Martin
  • 576
  • 1
  • 8
  • 27
0
votes
1 answer

Handling ftp data in python

I have a script that is pulling data from a file down from an ftp site using ftplib: ftp.retrlines('RETR '+weatherfile,callback=handleData) So I want to define handleData to deal with the data coming down, but I would like to be able to pass in…
dpawlows
  • 385
  • 3
  • 6
0
votes
2 answers

Handling parallel ftp download errors

I am downloading multiple files from a ftp server simultaneously using multiple sessions of Python. At some point one session (I suspect) reads a file that is being accessed by another process and throws the following error: Traceback (most recent…
Borealis
  • 8,044
  • 17
  • 64
  • 112
0
votes
1 answer

Fetching data from a ftp server

I have some code like this: def getnews(): try: server = 'ftp://25.102.81.171' ftp= ftplib.FTP(server) username = ' ' password = ' ' ftp.login(username,password) filename = 'news_2014.txt' path = 'news' ftp.cwd(path) …
user3167683
  • 131
  • 1
  • 1
  • 15
0
votes
2 answers

Python3 FTP Download

I try to download a file from webserver to local machine, but many files (folders) 1:1 to local. ftp.retrbinary('RETR Text.txt', open('/dev/sda1/text.txt', 'wb').write) [0Error: [Errno 20] Not a directory: '/dev/sda1/text.txt' whats wrong? How…
0
votes
1 answer

Setting a try / timeout with ftplib in python?

How can I set a timeout of 10~ seconds and if it fails to upload or times out to try again? Current code: print "Uploading LIST{}.html".format(counter) ftp_session = ftplib.FTP('ftp.website.com','admin@website.com','password123') rss_ftp_file =…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
0
votes
1 answer

Possible to zip a file (files?) and then unzip once uploaded or is upload and rename the only option?

I have no idea if this is possible... Let's say I want to put test.html into a .zip archive and then use ftplib to upload the file and then once uploaded for it to be extracted overwriting any files? If that's not possible whats the best way to…
Ryflex
  • 5,559
  • 25
  • 79
  • 148
0
votes
1 answer

Python ftplib file-transfer error_perm

I'm trying to automate a test in python 2.7 (in eclipse on linux ubuntu 12.04) and I need to test the FTP server the following: I have to create a file on a host, transfer it per FTP to another pc, and then transfer it back to my host under another…
0
votes
1 answer

python ftplib handbrake unrecognized file type

So I am trying to script some video file downloads from my ftp and send them to handbrake for encoding. I was having trouble with keeping the ftp socket open, but due to an amazing response from a SO user that is solved but: Now the file that is…
hammus
  • 2,602
  • 2
  • 19
  • 37
0
votes
1 answer

Cannot import FTP_TLS on EC2

I'm writing an FTP script in python on EC2 where I need to be able to import FTP_TLS for the connection. from ftplib import FTP_TLS Except, it gives me: ImportError: cannot import name FTP_TLS I can import FTP_TLS on my local python shell, but it…
Frank Bi
  • 208
  • 1
  • 4
  • 12
0
votes
2 answers

Python FTP-SSL / FTP-TLS: Verifying Public Certificate?

I'm using Python 2.7.5 (not 3.X) and I need to verify a FTPS (FTP-TLS) public certificate. That is, I want to verify it against the standard certificate authority, not a custom key. (Similar to HTTPS.) I see some options but I cannot get them to…
SilentSteel
  • 2,344
  • 1
  • 28
  • 28