TransWikia.com

FTP_TLS 530 Login Incorrect with Python3 when password contains §

Stack Overflow Asked by pLumo on December 7, 2021

I want to connect to my FTPS server using python3:

#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from ftplib import FTP_TLS

host='my.url'
user='myuser'
passwd='password_containing_§'

ftp=FTP_TLS(url)
ftp.set_debuglevel(2)
ftp.login(user,passwd)

But this gives an error whenever there is a § in the password.

*cmd* 'PASS ****************************************************************************************************'
*put* 'PASS ****************************************************************************************************rn'
*get* '530 Login incorrect.n'
*resp* '530 Login incorrect.'

Tested with Python 3.5.2 and 3.7.6, same issue.

The exact same code and data works well with Python2.7 (I just change the shebang to python2). Same login data also works well from Filezilla.

Can anybody help out ?


I read this similar question about sending the commands individually, but ftp.sendcmd(...) returns:

ftplib.error_perm: 550 SSL/TLS required on the control channel

One Answer

This was the solution:

passwd = passwd.encode('utf-8').decode('unicode-escape')

(via)

Answered by pLumo on December 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP