문제

I'm writing an FTP script in python on EC2 where I need to be able to import FTP_TLS for the connection.

from ftplib import FTP_TLS

Except, it gives me:

ImportError: cannot import name FTP_TLS

I can import FTP_TLS on my local python shell, but it fails on EC2.

What's going on?

EC2 Python 2.6.5 / Local Python 2.7.3

도움이 되었습니까?

해결책

FTP_TLS is only supported in Python 2.7+.

You could upgrade Python on your server, or just grab Lib/ftplib.py from source:

wget http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz

Put it in your load path and your import will work.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top