Hi,
I resend my question here adding some other info.:
When I try to upload many files I get such a error message:
Traceback (most recent call last):
File "I:\Python\my_py\wwwzaci\xcopy_ftp.py", line 51, in ?
except: x=host.upload(zdroj, cilFTP,'b')
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 463, in uplo ad
self.__copy_file(source, target, mode, open, self.file)
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 452, in __co py_file
target = target_open(target, target_mode)
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 265, in file
host = self._copy()
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 241, in _cop y
return FTPHost(*self._args, **self._kwargs)
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 138, in __in it__
self._session = self._make_session()
File "C:\prg\python24\Lib\site-packages\ftputil\ftputil.py",
line 235, in _mak e_session
return ftp_error._try_with_oserror(factory, *args, **kwargs)
File "C:\prg\python24\Lib\site-packages\ftputil\ftp_error.py",
line 78, in _tr y_with_oserror
raise TemporaryError(obj)
ftputil.ftp_error.TemporaryError: 421 Login Timeout (25 seconds):
closing contro l connection.
I think its not about many files but because of it takes too long
for my ftp server (25s). I tried many things but nothing helps.
Part of my code:
....
for root, dirs, files in os.walk(dirName):
#print host._session.sendcmd('NOOP') # this didnt help
pathRelFTP=ftpJoin(dirNameFTP+root.replace(dirName,''))
print '\n',pathRelFTP
if not host.path.exists(pathRelFTP):
host.mkdir(pathRelFTP)
for File in files:
myfile=os.path.join(root,File)
targetFTP=ftpJoin(pathRelFTP,File)
if os.path.splitext(File)[1] in text:
x= host.upload_if_newer(myfile, targetFTP)
else:
x= host.upload_if_newer(myfile, targetFTP,'b')
I can send all the code, but its quite long. I am trying in it to
send all the directory to ftpsite. ftpJoin is creating relative
ftp path from full local path. Everything else might be clear.
Any help is appreciated...
I got w2k, py24, ftputil 2.0.3
--
geon
--
Revoluční vysokorychlostní INTERNET jen za nízký měsíční paušál
399 Kč. Navíc aktivace ZDARMA! Více na
http://www.revolucniinternet.cz