I'm implementing the following method in python:
def install_s3cmd():
subprocess.call(['sudo easy_install s3cmd'])
# assuming that by now it's already been installed
import pexpect
# now use pexpect to configure s3cdm
child = pexpect.spawn('s3cmd --configure')
child.expect ('(?i)Access Key')
# ... more code down there
def main():
subprocess.call(['sudo apt-get install python-setuptools']) # installs easy_install
subprocess.call(['sudo easy_install pexpect']) # installs pexpect
install_s3cmd()
# ... more code down here
if __name__ == "__main__":
main()
I need to have pexpect installed, so I can install s3cmd --configure. pexpect is installed correctly, and in the first time the script is executed, I get an error saying it could find pexpect. However, the second time I run the script it work flawless. It's probably because python libraries hasn't been updated. How can I refresh, or update the python's module so I don't have that problem again?
setup.pyfor this script and let a tool like pip install the dependencies for you.