FTP not Returning (Python on Series 60 Nokia)
Serge Orlov
Serge.Orlov at gmail.com
Wed Mar 29 04:38:51 EST 2006
mbukhin at gmail.com wrote:
> I'm using the ftp library (layer on top of sockets) to transfer files
> from a series 60 to an ftp site. everything works fine, the whole
> file gets uploaded but the command never returns! so
> i call:
>
> ftp.storbinary('STOR ' + filename,F,1024) # store the image
>
> which does this:
>
> def storbinary(self, cmd, fp, blocksize=8192):
> '''Store a file in binary mode.'''
> self.voidcmd('TYPE I')
> conn = self.transfercmd(cmd)
> while 1:
> buf = fp.read(blocksize)
> if not buf: break
> conn.send(buf)
> conn.close()
> return self.voidresp()
>
> and the 'while 1' never stops. That's my guess anyway. When I run
> this in interactive bluetooth mode the storbinary command just hangs
> (though the file ends up on the server). i've tried a bunch of
> different things, counters, comparisons, everything. there's a signal
> library in python but i don't think it's supported in mobile devices.
>
> any suggestions?
Assuming conn is a socket .send() method is not guaranteed to send all
the data. Use .sendall() method. Are you sure the *whole* file is
uploaded?
Serge.
More information about the Python-list
mailing list