Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > getting mimetype of a file

Reply
Thread Tools

getting mimetype of a file

 
 
Ryan Paul
Guest
Posts: n/a
 
      05-31-2004
is there any way to determine the mimetype of a file using ruby?

TIA

--SegPhault
 
Reply With Quote
 
 
 
 
Ryan Paul
Guest
Posts: n/a
 
      05-31-2004
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?

 
Reply With Quote
 
 
 
 
Christos TZOTZIOY Georgiou
Guest
Posts: n/a
 
      05-31-2004
On Mon, 31 May 2004 19:58:10 GMT, rumours say that Ryan Paul
<(E-Mail Removed)> 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
 
Reply With Quote
 
Matteo Merli
Guest
Posts: n/a
 
      06-02-2004
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
 
Reply With Quote
 
Christos TZOTZIOY Georgiou
Guest
Posts: n/a
 
      06-02-2004
On Wed, 02 Jun 2004 08:52:20 GMT, rumours say that Matteo Merli
<(E-Mail Removed)_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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mimetype .aspx? =?Utf-8?B?UGF0cmljayBG?= ASP .Net 2 06-30-2007 12:25 PM
Howto Determine mimetype without the file name extension? Phoe6 Python 3 07-18-2006 08:36 PM
HtmlInputFile: mimetype of image/jpeg vs image/pjpeg? =?Utf-8?B?RGFuaWVsIENoYWl0?= ASP .Net 0 10-20-2004 12:15 PM
Problem with mimetype? Martin Honnen XML 3 06-26-2004 08:45 AM
getting mimetype of a file Ryan Paul Ruby 2 05-31-2004 10:22 PM



Advertisments