ftpilb.FTP.stor...() freeze mystery
gagsl-py2 at yahoo.com.ar
Fri Oct 30 02:47:54 CET 2009
En Thu, 29 Oct 2009 13:18:30 -0300, Anthra Norell
<anthra.norell at bluewin.ch> escribió:
> Gabriel Genellina wrote:
>> En Wed, 28 Oct 2009 08:05:22 -0300, Anthra Norell
>> <anthra.norell at bluewin.ch> escribió:
>>> Gabriel Genellina wrote:
>>>> En Tue, 27 Oct 2009 07:53:36 -0300, Anthra Norell
>>>> <anthra.norell at bluewin.ch> escribió:
>>>>> I am trying to upload a bunch of web pages to a hosting
>>>>> service.[...] I wrote a loop that iterates through the file names
>>>>> and calls either of the stor... () methods as appropriate. The loop
>>>>> successfully uploads eight of some twenty files and then freezes.
>>>>> Ctrl-C doesn't unlock the freeze. I have to kill the IDLE window
>>> freezes are less predictable than it seemed in the beginning. On one
>>> occasion it occurred after the transfer of a single file from the IDLE
>>> command line (my_ftp_object.storlines ("STOR file_name", f). The file
>>> did upload. So the freezes seem to occur after a successful transfer.
>> In this thread from last month, Sean DiZazzo shows how to add a timeout
>> parameter to storbinary:
>> Do the same with storlines and see whether it helps.
> Thanks a million! Here's a way out by the look of it. As the devil is in
> the details I get an error that indicates an inconsistency in my ftplib
> library (2.4) (*** marks my comments):
> Traceback (most recent call last):
> File "<pyshell#65>", line 1, in -toplevel-
> d2jm = upload.run (1)
> File "I:/DOK/projects/WEB/JM\upload.py", line 369, in run
> D2JM.copy_1_2 (do)
> File "I:/DOK/projects/WEB/JM\upload.py", line 342, in copy_1_2
> try: self.FS2.storbinary ('STOR %s' % name, f, timeout = timeout)
> *** Here's the call to the overwritten method with the timeout.
> File "I:/DOK/projects/WEB/JM\upload.py", line 440, in storbinary
> self.connection = self.transfercmd (command) *** command is 'STOR
> (target file name)'. Control passes to ftplib
> File "C:\PYTHON24\lib\ftplib.py", line 345, in transfercmd
> return self.ntransfercmd(cmd, rest)
> File "C:\PYTHON24\lib\ftplib.py", line 321, in ntransfercmd
> host, port = self.makepasv()
> File "C:\PYTHON24\lib\ftplib.py", line 299, in makepasv
> host, port = parse227(self.sendcmd('PASV'))
> File "C:\PYTHON24\lib\ftplib.py", line 566, in parse227
> raise error_reply, resp
> error_reply: 200 TYPE is now 8-bit binary <*** 'is now' indicates
> something has changed resulting in an inconsistency
> Is 'resp' supposed to be an int (227) rather than a string ('227')?
> Probably a wrong conclusion. In version 2.5 it is still a string.
> Anyway, I can't start editing the library trial-and-error style. So, I
> do thank you for the push. Mores pushes will be greatly appreciated, but
> I hesitate to invite travel companions for a stroll into this wilderness.
resp is a string, but not the response that PASV expected; apparently the
server is sending some unexpected responses. r52739 seems to fix that.
Perhaps you should upgrade to a newer Python version.
More information about the Python-list