I try a simple interaction with Titanium SDK and Python libftp.
Really simple: connect to my ftp server, choose a remote dir, upload a selected file. I found an error on set a CallBack for libftp.
Here the code:
import os.path
import sys
import ftplib
def uploadFile(name):
try:
command="STOR "+os.path.basename(name)
ftp=ftplib.FTP()
resp=ftp.connect('my.ftp.site')
resp=ftp.login('my_username','my_password')
ftp.cwd('TestPythonFTP')
ftp.storbinary(command,file(name,'rb'),8912,onProgress)
window.alert('Uploaded %s' % name)
except:
window.alert(sys.exc_info()[1])
Here the error trace:
(Python.KPythonObject) { class : <Python.KMethod at 0x5a0f20>, delattr : <Python.KMethod at 0x5b9960>, dict : (Python,KPythonDict) {}, doc : "Inappropriate argument type.", getattribute : <Python.KMethod at 0x5b9960>, getitem : <Python.KMethod at 0x5b8020>, getslice : <Python.KMethod at 0x5a0f20>, hash : <Python.KMethod at 0x5a3840>, init : <Python.KMethod at 0x5b9960>, new : <Python.KMethod at 0x5b8020>, reduce : <Python.KMethod at 0x5a0f20>, reduce_ex : <Python.KMethod at 0x5a3840>, repr : <Python.KMethod at 0x5b9960>, setattr : <Python.KMethod at 0x5b8020>, setstate : <Python.KMethod at 0x5a0f20>, str : <Python.KMethod at 0x5a3840>, args : (Python.KPythonTuple) [ "storbinary() takes at most 4 arguments (5 given)", ], message : "storbinary() takes at most 4 arguments (5 given)"}
Any idea? Thanks in advance