[New-bugs-announce] [issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

Robert Xiao report at bugs.python.org
Wed May 4 23:45:12 CEST 2011

New submission from Robert Xiao <nneonneo at gmail.com>:

On Python 3.2, calling abort() on an ftplib.FTP object will cause an exception:

>>> ftp = ftplib.FTP('localhost')
>>> ftp.abort()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.2/ftplib.py", line 246, in abort
    self.sock.sendall(line, MSG_OOB)
TypeError: 'str' does not support the buffer interface

The offending line, ftplib.py:246, should be replaced by
self.sock.sendall(line.encode(self.encoding), MSG_OOB)

components: Library (Lib)
messages: 135158
nosy: nneonneo
priority: normal
severity: normal
status: open
title: ftplib.FTP.abort fails with TypeError on Python 3.x
type: crash
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list