ahupp / python-magic

A python wrapper for libmagic
Other
2.6k stars 280 forks source link

s3cmd fails due to NameError: global name 'glob' is not defined #235

Closed jasonwoan closed 3 years ago

jasonwoan commented 3 years ago

Hi, our builds using s3cmd began failing a few hours ago due to this error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please try reproducing the error using
  the latest s3cmd code from the git master
  branch found at:
    https://github.com/s3tools/s3cmd
  and have a look at the known issues list:
    https://github.com/s3tools/s3cmd/wiki/Common-known-issues-and-their-solutions
  If the error persists, please report the
  following lines (removing any private
  info as necessary) to:
   s3tools-bugs@lists.sourceforge.net

Error loading some components of s3cmd (Import Error)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Problem: NameError: global name 'glob' is not defined
S3cmd:   2.0.2
python:   2.7.13 (default, Sep 26 2018, 18:42:22) 

Traceback (most recent call last):
  File "/usr/local/bin/s3cmd", line 3073, in <module>
    from S3.S3 import S3
  File "/usr/local/lib/python2.7/dist-packages/S3/S3.py", line 51, in <module>
    import magic
  File "/usr/local/lib/python2.7/dist-packages/magic/__init__.py", line 210, in <module>
    libmagic = loader.load_lib()
  File "/usr/local/lib/python2.7/dist-packages/magic/loader.py", line 22, in load_lib
    glob.glob('/usr/local/Cellar/libmagic/*/lib/libmagic.dylib'),  # flake8:noqa
NameError: global name 'glob' is not defined

Due to this commit? https://github.com/ahupp/python-magic/commit/b520bf0bf6f815afad33878ecdbe4b1d907dcc94#diff-d04c20ccda691c281f882ea4be84728f4917f6533ab80a310c47bced602bda8fR22

ahupp commented 3 years ago

ugh sorry. Fixed in e0ccc6d0cbf7b17e8c7288297c717f3b3d499679. I've tested on windows this time to verify this path.

ahupp commented 3 years ago

And released 0.4.22

jasonwoan commented 3 years ago

@ahupp Thanks for the prompt patch. Appreciate your efforts!