Error in 0.9.9

2009-02-24
2013-02-19
  • 0.9.9 has a rather irritating flaw in the way that it reports errors.

    At the bottom of s3cmd.py, it tries to import lots of things from S3, and catches the error in order to print out an error message.

    But the error message is generated and formatted using PkgInfo and ParameterError; both of which are defined in the imports.

    So, if for any reason the imports fail (in my case, because I'd installed to the wrong location accidentally, so the S3 directory wasn't on my PYTHONPATH) then s3cmd will throw mysterious NameErrors because PkgInfo and/or ParameterError are undefined.

    This is very puzzling until you work out what's going on.

    It would be nicer if you didn't catch the ImportError's at all - at least that way I can guess at the problem!

     
    • Michal Ludvig
      Michal Ludvig
      2009-02-25

      Fixed in SVN now. Thanks for the report. Now it will print something like this:

      =========
      Problem: ImportError: cannot import name Progress
      S3cmd:   0.9.9

      Traceback (most recent call last):
        File "./s3cmd", line 1609, in <module>
          from S3.Progress import Progress
      ImportError: cannot import name Progress

      Your sys.path contains these entries:
              /home/mludvig/src/s3cmd
              /usr/lib/python25.zip
              /usr/lib/python2.5
              /usr/lib/python2.5/plat-linux2
              /usr/lib/python2.5/lib-tk
              /usr/lib/python2.5/lib-dynload
              /usr/lib/python2.5/site-packages
              /usr/lib/python2.5/site-packages/Numeric
              /usr/lib/python2.5/site-packages/PIL
              /usr/lib/python2.5/site-packages/gtk-2.0
              /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode
              /usr/local/lib/python2.5/site-packages
      Now the question is where have the s3cmd modules been installed?