Just want to provide a solution of problem I’ve faced, maybe it will be usefull for someone. Issue is next:
We need to connect to remote ftp server, download and delete existing files.
Look’s easy, let’s use standard library ftplib:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
Code was working nicely untill one moment i get exception 530 SSL required. The deal is because of user configuration on remote server, it is set to reguire SSL/TLS encryption. But standard ftplib in my version of python 2.6.5 doesn’t provide solution to connect with SSL/TLS, it was added in python 2.7. Version update looks bad, external libraries i also dont want to use. So i decided to get ftplib module from 2.7 version and use in my code.(Download 2.7 version and locate ftplib.py file) After replacing standard ftplib file in you pythonpath with one from 2.7 our code looks like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Also I want to notice if you do not want to break anything with further using ftplib library after replacing, my suggestion is to not replace files but to use file as separate module(e.g. if you run code from your own package copy downloaded file in it and include in init.py, the in code where you want to use it import like from <your_module_name> import ftplib as ftplib2.7).