[New-bugs-announce] [issue25491] ftplib.sendcmd only accepts string

wozlaf report at bugs.python.org
Tue Oct 27 10:39:48 EDT 2015


New submission from wozlaf:

The FTP server (ProFTPD 1.3.5a) returns some file and folder names not properly encoded in UTF-8, when requesting with FTP command "MLSD" and "OPTS UTF8 ON".
To access I need to send them back to the server exactly as they came (bytes) with ftp.sendcmd(b"CWD" + path_bytes).

This results in an exception:
 File "C:\Python34\lib\ftplib.py", line 190, in putline
 line = line + CRLF
 TypeError: can't concat bytes to str

Sadly this makes ftplib only support sending of UTF-8 commands and file names. So I need to work around with my own version of "sendcmd" for now.

"ftplib.sendcmd()" should handle bytes and strings (UTF-8).

----------
components: Library (Lib)
messages: 253542
nosy: wozlaf
priority: normal
severity: normal
status: open
title: ftplib.sendcmd only accepts string
type: behavior
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25491>
_______________________________________


More information about the New-bugs-announce mailing list