Python连接到FTP错误:NotImplementedError

时间:2016-01-04 09:09:50

标签: python ftp openshift pyftpsync

我想使用Python模块pyftpsync模块(在rhc openshift服务器上)。但是当我连接到ftp服务器时,它会导致错误。但是我可以用我的电脑上的FileZilla软件连接到ftp服务器。

代码在这里:

cd /tmp

cat << 'EOF' > ftp_sync2.py
from ftpsync.synchronizers import DownloadSynchronizer, UploadSynchronizer,BiDirSynchronizer

from ftpsync.targets import FsTarget #, UploadSynchronizer, DownloadSynchronizer
from ftpsync.ftp_target import FtpTarget
import os

env_var = os.environ['OPENSHIFT_HOMEDIR']
#local = FsTarget(env_var+"/app-root/runtime/repo/php/")
local = FsTarget('/tmp/')

passwd = "ss123456"

ip='f12-preview.atspace.me';user='XXXXXXXX';#  XXXXXXXXX@yahoo.om

#ip='XXXXXXX';user='XXXXXXX';# X@yahoo.om
ip='ftp.ucq.me';user='XXXXXX';#  wXr@yahoo.om
ip='X';user='ssasa';#  X@yahoo.om
ip='f13-preview.awardspace.net';user='X';passwd='X'#  

X@yahoo.om

remote = FtpTarget("/home/www/", ip,21, user, passwd)
#remote = FtpTarget("/work/communiuty", ip,21, user, passwd)
remote = FtpTarget("/", ip,21, user, passwd)

opts = {"force": False, "delete_unmatched": False, "verbose": 3, "execute": True, "dry_run" : False}

s = UploadSynchronizer(local, remote, opts)

s.run()
stats = s.get_stats()
print(stats)
EOF

nohup sh -c " ${OPENSHIFT_HOMEDIR}/app-root/runtime/srv/python/bin/python ftp_sync2.py"> $OPENSHIFT_LOG_DIR/python_ftp_sync2.log /dev/null 2>&1 &  
tail -f  $OPENSHIFT_LOG_DIR/python_ftp_sync2.log

错误在于:

Upload /tmp
                  to ftp:f13-preview.awardspace.net/
Traceback (most recent call last):
  File "ftp_sync2.py", line 29, in <module>
    s.run()
  File "/var/lib/openshift/565e0df60c1e661889000146/app-root/runtime/srv/python/lib/python2.7/site-packages/pyftpsync-1.0.3-py2.7.egg/ftpsync/synchronizers.py", line 128, in run
    res = self._sync_dir()
  File "/var/lib/openshift/565e0df60c1e661889000146/app-root/runtime/srv/python/lib/python2.7/site-packages/pyftpsync-1.0.3-py2.7.egg/ftpsync/synchronizers.py", line 375, in _sync_dir
    remote_entries = self.remote.get_dir()
  File "/var/lib/openshift/565e0df60c1e661889000146/app-root/runtime/srv/python/lib/python2.7/site-packages/pyftpsync-1.0.3-py2.7.egg/ftpsync/ftp_target.py", line 270, in get_dir
    self.ftp.retrlines("MLSD", _addline)
  File "/var/lib/openshift/565e0df60c1e661889000146/app-root/runtime/srv/python/lib/python2.7/ftplib.py", line 443, in retrlines
    callback(line)
  File "/var/lib/openshift/565e0df60c1e661889000146/app-root/runtime/srv/python/lib/python2.7/site-packages/pyftpsync-1.0.3-py2.7.egg/ftpsync/ftp_target.py", line 263, in _addline
    raise NotImplementedError
NotImplementedError

为什么会这样?

0 个答案:

没有答案