The reasons are two.
- Normally, we have no permission to install modules in cluster
- We don't want install each node in the cluster.
This can be achieved by ZipImport
1. Prepare pysftp library.
Download pysftp-0.2.8.tar.gz, tar -xzvf pysftp-0.2.8.tar.gz
zip -r pysftp.mod pysftp.py
copy pysftp to app/lib
2.
import zipimport importer = zipimport.zipimporter('lib/pysftp.mod') pysftp = importer.load_module('pysftp') sftp = pysftp.Connection(ftp_host, username=ftp_username, password=ftp_password)
Reference:
https://docs.python.org/2/library/zipimport.html
http://atbrox.com/2009/11/11/how-to-combine-elastic-mapreducehadoop-with-other-amazon-web-services/
No comments:
Post a Comment