This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ivan.Pozdeev
Recipients Ivan.Pozdeev, giampaolo.rodola, peterpan
Date 2016-12-14.20:49:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481748566.65.0.691044551766.issue25458@psf.upfronthosting.co.za>
In-reply-to
Content
* The initial msg253326 has a code snippet using ftplib directly and showing the error.
* The linked issue28931 has another snippet that uses ftplib through urllib and results in the same error.

There isn't a single mention of "thread" in either.
Could you just run either of them and see for yourself?

I can rub your nose in it, but I thought you're better than that :)

Oh well...

C:\Ivan>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ftplib
>>> ftp = ftplib.FTP()
>>> ftp.connect('ftp.debian.org', timeout=10)
'220 ftp.debian.org FTP server'
>>> ftp.login('anonymous','user@example.com')
'230 Login successful.'
>>> ftp.sendcmd('TYPE A')
'200 Switching to ASCII mode.'
>>> s = ftp.transfercmd('LIST')
>>> fp = s.makefile('r')
>>> fp.read()
'drwxr-xr-x    9 1176     1176         4096 Dec 14 15:08 debian\r\n'
>>> fp.close()
>>> s.close()
>>> # Now the session is broken:
...
>>> ftp.sendcmd('NOOP')
'226 Directory send OK.'
>>> ftp.dir()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Py\lib\ftplib.py", line 534, in dir
    self.retrlines(cmd, func)
  File "C:\Py\lib\ftplib.py", line 437, in retrlines
    conn = self.transfercmd(cmd)
  File "C:\Py\lib\ftplib.py", line 376, in transfercmd
    return self.ntransfercmd(cmd, rest)[0]
  File "C:\Py\lib\ftplib.py", line 334, in ntransfercmd
    host, port = self.makepasv()
  File "C:\Py\lib\ftplib.py", line 312, in makepasv
    host, port = parse227(self.sendcmd('PASV'))
  File "C:\Py\lib\ftplib.py", line 830, in parse227
    raise error_reply, resp
ftplib.error_reply: 200 Switching to ASCII mode.
History
Date User Action Args
2016-12-14 20:49:26Ivan.Pozdeevsetrecipients: + Ivan.Pozdeev, giampaolo.rodola, peterpan
2016-12-14 20:49:26Ivan.Pozdeevsetmessageid: <1481748566.65.0.691044551766.issue25458@psf.upfronthosting.co.za>
2016-12-14 20:49:26Ivan.Pozdeevlinkissue25458 messages
2016-12-14 20:49:26Ivan.Pozdeevcreate