aws / aws-cli

Universal Command Line Interface for Amazon Web Services
Other
15.48k stars 4.11k forks source link

aws command: 'module' object has no attribute 'main' #109

Closed xueshanf closed 11 years ago

xueshanf commented 11 years ago

I cloned the aws-cli from git clone https://github.com/aws/aws-cli.git. Then I built a .deb package (after installed all other dependencies). When I ran /usr/bin/aws command, it generated the following errors:

Traceback (most recent call last):
  File "/usr/bin/aws", line 23, in <module>
    sys.exit(main())
  File "/usr/bin/aws", line 19, in main
    return awscli.clidriver.main()
AttributeError: 'module' object has no attribute 'main'

For trouble-shooting, I installed the package using pip. /usr/local/bin/aws runs without problem.

I noticed that the two 'aws' commands are different (/usr/bin /aws is from git, /usr/local/bin is from pip), see below diff output.

What I have missed? Thanks!

diff -B -b  -u /usr/bin/aws /usr/local/bin/aws
--- /usr/bin/aws        2013-05-04 12:22:58.000000000 -0700
+++ /usr/local/bin/aws  2013-05-04 08:53:25.000000000 -0700
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/python
 # Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.

 # Licensed under the Apache License, Version 2.0 (the "License"). You
@@ -16,7 +16,8 @@

 def main():
-    return awscli.clidriver.main()
+    driver = awscli.clidriver.CLIDriver()
+    return driver.main()

 if __name__ == '__main__':
garnaat commented 11 years ago

It seems that you have a new version of the aws script (the one with the return awscli.clidriver.main()) that is importing an older version of the package files. This is a relatively recent change (7dc65d267a6b8a2541a3e6ff1c026a6e20e4d736) and you definitely need to use the right script with the right package. I'm not sure how things are getting confused within your environment.