1

I am using s3cmd to upload files. and it always upload .png file as "image/x-png" for MIME type.

So I decide to install "python-magic"

What I did here:

Installed Python 2.7 x86 on Windows 7 64bit, (since the manual of "python-magic" said only x86 will work) download from http://www.python.org/download/releases/2.7/

Installed Python Extention Setuptools http://www.lfd.uci.edu/~gohlke/pythonlibs/#setuptools

Download & Installed https://github.com/ahupp/python-magic , use 'C:\Python27\python setup.py install'

Found the 3 files ( magic1.dll, zlib1.dll, regex2.dll, as required by python-magic ) and copied to Windows/System32

ok, at last s3cmd is using python-magic for MIME, BUT errors:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    An unexpected error has occurred.
  Please report the following lines to:
   s3tools-bugs@lists.sourceforge.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Problem: MagicException: could not find any magic files!
S3cmd:   1.1.0-beta3

Traceback (most recent call last):
  File "T:\My\Downloads\s3cmd\s3cmd", line 1788, in <module>
    from S3.S3 import S3
  File "T:\My\Downloads\s3cmd\S3\S3.py", line 35, in <module>
    magic_ = magic.Magic(mime=True)
  File "build\bdist.win32\egg\magic.py", line 51, in __init__
    magic_load(self.cookie, magic_file)
  File "build\bdist.win32\egg\magic.py", line 138, in errorcheck
    raise MagicException(err)

Please advice how or where can I get some magic files.

Eric Yin
  • 8,737
  • 19
  • 77
  • 118
  • 1
    Try to add magic1.dll to the same script directory. – Denis Aug 28 '13 at 18:26
  • Thanks @Denis, its no exception now. But PNG still upload as `image/x-png` any idea? – Eric Yin Aug 28 '13 at 20:30
  • How I unserstand magic1.dll is a MIME types library and if it detect your file as image/x-png that's right. Read this http://stackoverflow.com/questions/2086374/what-is-the-difference-between-image-png-and-image-x-png – Denis Aug 29 '13 at 08:22
  • 1
    @Denis, thanks. 1st, can you put your comment as answer so I can mark the question answered. 2nd, do you know how to edit magic1.dll, I really like image/x-png be image/png – Eric Yin Aug 29 '13 at 13:51

0 Answers0