FTP not Returning (Python on Series 60 Nokia)

mbukhin at gmail.com mbukhin at gmail.com
Wed Mar 29 03:06:22 EST 2006


Thanks for the 'debug mode' tip.  My file is only 24k (a photo) and the
whole thing makes it to the FTP server.  It's just the command never
returns so my program cannot continue execution.  When I do turn
debugging on, the last command I see is:

*resp* '150 Connection accepted'

Could it be my FTP server?  I'm using a windows install of FileZilla.
I did have to make one patch to the ftplib.  There is a documented
problem where routers mangle
return text:

227 Entering Passive Mode (192,168,0,3,13,248)

into something like

227 Entring Passive Mode (192,168,0,3,13,248

Pulling off the trailing paren (see:
http://filezilla.sourceforge.net/forum/viewtopic.php?p=6109&sid=d9126f7830afe301c7e4948c2c84153b).
 I edited the parse227 call to not look for the trailing paren.

Anywhere else i can look?  I'm running my program line by line in the
bluetooth console and it hangs on the storbinary.  When I run the
program directly on the phone as a single exe the same thing happens.

thanks

(Code & output)

Sample Code:

from appuifw import *
from graphics import *
from ftplib import FTP
import camera
import e32
import time
import httplib, urllib
from key_codes import *




picselection = 'e:\\picture.jpg'
ftp = FTP('xx.xx.xxx.xxx') # connect to host
ftp.set_debuglevel(2)
ftp.set_pasv('true')
ftp.login('mike','xxxxx')
F=open(picselection,'rb')
filename = time.strftime("%Y-%m-%d-%H-%M-%S.jpg",time.localtime())
e32.ao_yield()
ftp.storbinary('STOR ' + filename,F,1024) # store the image
e32.ao_yield()
ftp.quit()
F.close()

Debug output:

*cmd* 'USER mike'*put* 'USER mike\r\n'
*get* '331 Password required for mike\r\n'
*resp* '331 Password required for mike'
*cmd* 'PASS *******'
*put* 'PASS *******\r\n'
*get* '230 Logged on\r\n'
*resp* '230 Logged on''230 Logged on'
>>> F=open(picselection,'rb')
>>> filename = time.strftime("%Y-%m-%d-%H-%M-%S.jpg",time.localtime())
>>> e32.ao_yield()
>>> ftp.storbinary('STOR ' + filename,F,1024) # store the image
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 Type set to I\r\n'
*resp* '200 Type set to I'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entring Passive Mode (69,86,224,242,13,248\r\n'
*resp* '227 Entring Passive Mode (69,86,224,242,13,248'
*cmd* 'STOR 2006-03-29-02-59-13.jpg'
*put* 'STOR 2006-03-29-02-59-13.jpg\r\n'
*get* '150 Connection accepted\r\n'
*resp* '150 Connection accepted'




More information about the Python-list mailing list