Questions tagged [ftplib]
ftplib — FTP protocol client under Python programming language
587
questions
0
votes
0answers
12 views
How to unit test FTP connection with FTPS/TLS version 1.2?
I have a Python code to read some files from FPT using FTPS and TLS version 1.2, this is the function, the credentials are read from AWS secret manager:
def ftp_connection(host, username, password):
...
0
votes
1answer
27 views
error_perm_500 using ftplib in Python
Within my Python script I am using ftplib. However, I am encountering the error_perm: 500 ? error upon performing the below operation:
filename = '31379-den-katastrofy-2-konec-sveta-film-2005.html'
...
2
votes
1answer
33 views
Identify new files in FTP and write them to AWS S3
I'm currently using ftplib in Python to get some files and write them to S3.
The approach I'm using is to use with open as shown below:
with open('file-name', 'wb') as fp:
ftp.retrbinary('...
0
votes
1answer
22 views
Exception handling using ftplib package in Python
I'm new to ftplib and FTP in Python, I'm testing a simple script provided by the documentation: https://docs.python.org/3/library/ftplib.html#ftplib.error_reply
try:
ftp = ftplib.FTP('ftp.us....
-1
votes
0answers
17 views
Python ftplib fails to upload file while winscp works fine
Setup:
Windows 10
Python 3.8.2
winscp 17.x
Python code that fails
ftps = FTP_TLS()
ftps.set_debuglevel(level=2)
ftps.connect(host)
ftps.login(user, password)
ftps.prot_p()
ftps.retrlines('LIST')
...
1
vote
1answer
49 views
Meaning of “site sbd” when working with mainframe PDS using Python ftplib
I have gone through the below link for connecting to mainframe and extracting files from a PDS.
Downloading text files with Python and ftplib.FTP from z/os
But, am having few doubts on the line:
sess....
0
votes
1answer
24 views
Problems uploading folders containing files to FTP Server Python
I am developing a FTP client and Server written in python. In my client's local directory it contains a folder containing many sub folders (E.G: C:/PatientRecords/A/, C:/PatientRecords/B/). Inside the ...
1
vote
1answer
21 views
Is it possible download file with Python ftplib at the same time as retrieving file list information from the list function?
I have a scenario that looks something like below. My goal is to print out the lines of the file that I'm retrieving from the Python ftplib retrlines("LIST") function. Any help is ...
2
votes
2answers
34 views
Read CSV over FTP line by line without storing the whole file in memory/disk
I'm stuck piping ftplib.FTP.retrlines to csv.reader...
FTP.retrlines repeatedly calls a callback with a line in it, while csv.reader expects an iterator which returns a string each time its __next__() ...
2
votes
3answers
54 views
To read the latest csv file automatically from an FTP directory on Pandas
I am a beginner in Python programming but I believe the problem I am trying to solve might not be a big one.
So I am working on a program to present the last row on the latest csv file to the end user....
0
votes
1answer
40 views
Download multiple files from FTP share? [duplicate]
I know this question has been asked multiple times, but none of the solutions actually worked so far.
I would like to pull some files to a web tool based on an URL.
This seems to be an FTP share but ...
0
votes
0answers
24 views
write on FTP file without overwrite previous text ftplib python [duplicate]
I'm trying to write on hosted file from python, so I chose to use ftplib module.
So far i got this code
from ftplib import FTP
import io
ftp = FTP('ftp.myhostname.com')
ftp.login('myusername','mypass')...
1
vote
1answer
21 views
Uploading in-memory numpy image array to FTP server using Python ftplib results in an empty file
Need help to upload numpy array image to an FTP server.
I have read some topic about keep file in temp but I already try and not work ;(
import ftplib
from PIL import Image
from io import BytesIO
...
0
votes
0answers
18 views
How can I make a loop in ftplib? [duplicate]
I shared code that is working for uploading a directory's files to an FTP server. But I want to make a loop and it must happen continuously. Because I want to export a file to a folder and this code ...
1
vote
1answer
36 views
Reading first N lines of file on FTP server in Python
I have a CSV file on an FTP server. The file is around 200mb.
For now, I am reading the file using the following method, the issue with this implementation is that the file takes too long to download, ...
0
votes
1answer
28 views
FTP No Transfer Timeout While Transferring - Python ftplib
Not very knowledgeable with FTP Servers... Transferring a large amount of data (in textual format) from the NOAA (National Oceanic and Atmospheric Administration) FTP server and inserting it to a SQL ...
0
votes
0answers
13 views
Is their a way to use TK Askdirectory to specify the folder you want to download to when downloading using ftp.retrbinary
I am trying to have this code do the following
Ask the user which folder they want to download too.
Down load the file from the FTP server to the selected file
but when ever I run the following code ...
4
votes
1answer
63 views
FTPSHook Airflow (522 SSL/TLS required on the data channel)
I'm trying to use FTPSHook to send file through FTP TLS/SSL Explicit Encryption. Here's my code
remote_filepath=pathfile
local_filepath=pathfile2
hook = FTPSHook(ftp_conn_id='ftp_test')
hook....
0
votes
1answer
29 views
ftplib - download with showing hash mark on screen and be able to interrupt anytime
I want to use ftplib to download a file.
import ftplib
class Ftp:
def start(self):
self.ftp = ftplib.FTP('speedtest.tele2.net')
self.ftp.login()
with open('1GB.zip', 'wb') as f:
...
0
votes
0answers
64 views
ftplib - 550 Home directory does not exist but Filezilla is working
I have a problem logging into a sftp (ssh) server with this code:
from ftplib import FTP_TLS
import ftplib
ftp_host = 'XXX'
ftp_user = 'XXX'
ftp_pass = 'XXX'
ftps = FTP_TLS(ftp_host)
ftps.login(...
1
vote
1answer
39 views
Downloading file with a space in filename using ftplib
I'm downloading two files from a C-More industrial HMI FTP server. I don't know what OS the HMI is running but I suspect that its FTP server has some quirks. Using Jython 2.7, one file can be read ...
0
votes
0answers
23 views
Parallelizing FTP requests (MLSD) with ftplib
I am trying to crawl an FTP server in parallel to find out the directory structure, using Python's ftplib. My algorithm as such just sends the MLSD command, parses all the subdirectories from the MLSD ...
1
vote
1answer
95 views
Python - Write in text mode to file opened in binary mode
I am asking this out of curiosity.
What I am doing:
creating a temp file
writing data from a Pandas dataframe to it by using to_csv()
pushing the file to a FTP server
As the tempfile is opened in ...
0
votes
1answer
21 views
Python ftplib - connecting through a proxy with custom port
My question then, is how do I modify the connection string to cater for the particulars that my firewall is expecting?
This one is a little bit of a compound issue.
I am connecting from behind an ...
1
vote
1answer
28 views
File changes its size to 0 KB on VPS
I have this in crontab:
*/6 * * * * python3 /root/projects/download.py >> /root/projects/download_errors.log 2>&1
*/10 * * * * python3 /root/projects/upload.py >> /root/projects/...
0
votes
2answers
39 views
How do I use ftp.storbinary to upload a file? [duplicate]
I am just starting to learn Python. I'm trying to upload a file as follows:
import ftplib
myurl = 'ftp.example.com'
user = 'user'
password = 'password'
myfile = '/Users/mnewman/Desktop/requested.txt'
...
0
votes
1answer
16 views
Trying to use ftplib and discord.py together.. having some issues
having some issues and hopefully I can get some assistance :D... the code is below
from ftplib import FTP
import shutil
import urllib.request as request
from contextlib import closing
import os
import ...
1
vote
2answers
39 views
Recursive file list with FTP
I know how to list all files in a directory from a FTP server:
import ftplib
ftp = ftplib.FTP()
ftp.connect("192.168.1.18", port=2240)
ftp.login()
ftp.cwd('path/to')
for f in ftp.mlsd():
...
0
votes
0answers
55 views
534 Policy requires SSL when trying to connect to an FTPS server with python ftplib [duplicate]
I'm trying to file drop to an ftps server and when I check the logs I'm getting
ERROR [root.action:120] (<class 'ftplib.error_perm'>, error_perm('534 Policy requires SSL.',),
Here is my python ...
0
votes
0answers
55 views
FTP upload File error with Ftplib in the python
I use ftplib, but can not upload files to the server. Two methods do not to work
import ftplib
ftp = ftplib.FTP()
ftp.set_debuglevel(2)
ftp.encoding = 'utf-8'
try:
ftp.connect(host, port)
ftp....
0
votes
1answer
28 views
add timestamp in file downloaded from FTP Server using Python [duplicate]
I have a python script (v3.8) that gets a file once per day from an FTP Server and I want to add the timestamp of the file's creation date at the server when I save it locally.
My code so far:
from ...
5
votes
2answers
73 views
ftplib python - returning error that login or password is incorrect
I am trying to use the python library "ftplib". I am able to connect to the FTP server on my MacBook just fine, using the finder settings under "Go --> Connect to Server..."
...
1
vote
1answer
22 views
Trying to download a series of archives from NCBI ftp using python ftplib but ftplib freezes at end of long file transfer
I'm trying to download the nr blastdabase form NCBIs ftp site (ftp://ftp.ncbi.nlm.nih.gov/blast/db). One of the files is quite large (16GB) and takes some time to download. At the end of downloading ...
0
votes
1answer
63 views
FTPS to AWS S3 with ftplib and boto3 Error: Fileobj must implement read
I'm working on creating a data transfer in python from our ftps site to a S3 bucket.
for ftp_file in files_to_upload:
ftp_file_obj = self.ftp_client.retrbinary('RETR '+ftp_file,open(...
0
votes
0answers
23 views
How download directory with ftplib [Python3] [duplicate]
When i downloaded the files that i have on the FTP server, the folders are downloaded as if they were files without extension, how can i download them too?
print(color.CODE + '[INFO] Iniciando ...
0
votes
0answers
32 views
I am struggling to upload the file with Python to FTPS site (FTP_TLS)
It connects at first -
*resp* '200 Port command successful'
*cmd* 'STOR DT_20201106.csv'
*resp* '150 Opening data channel for file upload to server of "/test/DT_20201106.csv"'
But then I ...
0
votes
0answers
25 views
Find dates / hours from multiple string format in python
I need to parse some strings into datetime object in python.
Problem is : I'm fetching my strings from multiple FTP servers wich are returning different strings.
MLSD and MLSN are a no go because some ...
1
vote
1answer
49 views
Cannot establish SSL connection with FTP using certfile (python)
I'm trying to establish a connection with a FTP server using ftplib.
I received two files, a certificate with .crt extension and a certificate in PEM format (RSA KEY + Certificate).
I'm using the ...
1
vote
1answer
40 views
Python ftplib UnicodeDecodeError while trying to upload mp4 file
I'm trying to upload mp4 file via ftp using ftplib in Python. But I got UnicodeDecodeError.
Below is what I tried:
import ftplib
from pathlib import Path
def send_file(file_path, host, username, ...
1
vote
1answer
31 views
Python - ftplib - Universal file list collector
I've been working on a Python project. Main goal is to retrieve files (name and last used time).
I'm working on a quite large company and we have dozens of different servers that I need to check.
I've ...
1
vote
1answer
131 views
Python FTP (ftplib): Request longer timeout? (WinError 10054 An existing connection was forcibly closed by the remote host)
I upload lots of large files (3.4 GB each) to stock footage websites and I wrote a python script to upload them sequentially to each site. Usually it works with no issues, but today, the files failed ...
0
votes
2answers
22 views
Python FTPlib is creating files with unix clrf instead of windows cldf
I'm on a Windows PC and I'm trying to download files from an FTP. The files download fine, but the only issue when I open them up in Notepad is that it's displayed with a Unix (LF). I've tried a ...
0
votes
1answer
37 views
Open a json file in a FTP using ftplib
from our project, we are required to use ftplib module. I'm using ftplib to read the content of the json file in the FTP but it shows an error [Errno 2] No such file or directory: 'test.json'
Here's ...
0
votes
1answer
51 views
Does retrbinary() and storbinary() in ftplib raise exception if transfer not successful?
Do the retrbinary() and storbinary() functions in ftplib raise exceptions if transfer not successful (or do I need to explicitly check for this)?
Eg. I currently have code that does...
ftp = ftplib....
1
vote
2answers
40 views
Access FTP URL with ftplib [duplicate]
I am using python in Windows with ftplib to access a folder at ftp5.xyz.eu.
The folder is 'baz' in ftp5.xyz.eu in the folder 'foo bar'. So : ftp5.xyz.eu/foo bar/baz
I connect successfully at ftp5....
0
votes
0answers
19 views
ftplib nlst with directory argument returns nothing
Trying to use nlst (https://docs.python.org/3/library/ftplib.html#ftplib.FTP.nlst) from ftplib to get a list of file names from an FTP dir, but even though I know that there are files in that dir, ...
0
votes
1answer
20 views
How to get listing of directory from local FTP server
I'm working on a client-server program that uses FTP and right now I'm trying to figure out a way to list the directories from a local host and display the file name and file size. I know how to do ...
0
votes
1answer
74 views
use python ftplib downloading but get ConnectionRefusedError: [Errno 111] Connection refused
I was trying use ftplib to download from a FTP server, but I get ConnectionRefusedError: [Errno 111] Connection refused
This is my code:
import os
import sys
import configparser
import socket
def ...
-2
votes
1answer
23 views
Downloading Files from FTP server which is updated in last n hours
My requirement is to download the files which are arrived in the root directory in the last 24 hours.
The code below is working in a subdirectory (let's say ftp.cwd("/Landing/") but trigger ...
0
votes
1answer
79 views
How to read an image file from ftp and convert it into an opencv image without saving in python
The question is self explanatory, basically I want to read an image file from ftp using ftplib and convert it into an opencv image but without saving it on the disk in python.
Thanks