Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top