getting mimetype of a file

Discussion in 'Python' started by Ryan Paul, May 31, 2004.

  1. Ryan Paul

    Ryan Paul Guest

    is there any way to determine the mimetype of a file using ruby?

    TIA

    --SegPhault
    Ryan Paul, May 31, 2004
    #1
    1. Advertising

  2. Ryan Paul

    Ryan Paul Guest

    On Mon, 31 May 2004 19:54:53 +0000, Ryan Paul wrote:

    > is there any way to determine the mimetype of a file using ruby?
    >
    > TIA
    >
    > --SegPhault


    =P just realized I sent this to the wrong list. as long as I'm here... how
    is it done in python?
    Ryan Paul, May 31, 2004
    #2
    1. Advertising

  3. On Mon, 31 May 2004 19:58:10 GMT, rumours say that Ryan Paul
    <> might have written:

    >> is there any way to determine the mimetype of a file using ruby?

    [snip]
    >=P just realized I sent this to the wrong list. as long as I'm here... how
    >is it done in python?


    The mimetypes.py module in the standard library is your friend.
    --
    TZOTZIOY, I speak England very best,
    "I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
    Christos TZOTZIOY Georgiou, May 31, 2004
    #3
  4. Ryan Paul

    Matteo Merli Guest

    Christos TZOTZIOY Georgiou wrote:

    >>> is there any way to determine the mimetype of a file using ruby?

    > [snip]
    >>=P just realized I sent this to the wrong list. as long as I'm here... how
    >>is it done in python?

    >
    > The mimetypes.py module in the standard library is your friend.


    A more effective approach would be to use the "magic" module that come
    with the "file" utility (it is present in the sources, but not built by
    default).
    This way you can perform a fine-grained recognition of files..

    Matteo
    Matteo Merli, Jun 2, 2004
    #4
  5. On Wed, 02 Jun 2004 08:52:20 GMT, rumours say that Matteo Merli
    <_punto_it> might have written:

    >Christos TZOTZIOY Georgiou wrote:
    >
    >>>> is there any way to determine the mimetype of a file using ruby?

    >> [snip]
    >>>=P just realized I sent this to the wrong list. as long as I'm here... how
    >>>is it done in python?

    >>
    >> The mimetypes.py module in the standard library is your friend.


    ....if one wants to judge by the filename only (I wasn't clear earlier).

    >A more effective approach would be to use the "magic" module that come
    >with the "file" utility (it is present in the sources, but not built by
    >default).
    >This way you can perform a fine-grained recognition of files..


    Indeed. One such attempt (mine) to use the "magic" file from python can
    be found here:

    http://www.sil-tec.gr/~tzot/python/
    --
    TZOTZIOY, I speak England very best,
    "I have a cunning plan, m'lord" --Sean Bean as Odysseus/Ulysses
    Christos TZOTZIOY Georgiou, Jun 2, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGFuaWVsIENoYWl0?=

    HtmlInputFile: mimetype of image/jpeg vs image/pjpeg?

    =?Utf-8?B?RGFuaWVsIENoYWl0?=, Oct 20, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    922
    =?Utf-8?B?RGFuaWVsIENoYWl0?=
    Oct 20, 2004
  2. =?Utf-8?B?UGF0cmljayBG?=

    Mimetype .aspx?

    =?Utf-8?B?UGF0cmljayBG?=, Mar 11, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    22,177
    oliiix
    Jun 30, 2007
  3. Martin Honnen

    Problem with mimetype?

    Martin Honnen, Jun 25, 2004, in forum: XML
    Replies:
    3
    Views:
    525
    Rolf Magnus
    Jun 26, 2004
  4. Phoe6
    Replies:
    3
    Views:
    670
    dwelch91
    Jul 18, 2006
  5. Ryan Paul

    getting mimetype of a file

    Ryan Paul, May 31, 2004, in forum: Ruby
    Replies:
    2
    Views:
    106
    Shu-yu Guo
    May 31, 2004
Loading...

Share This Page