Detecting MIME type of a shared file

James Simmons jim.simmons at walgreens.com
Wed Mar 19 18:08:22 EDT 2008


Tomeu and Michael,

It turns out Python has a method you can pass a filename to and it will 
identify if the file is a Zip file or not, based on the "magic number", 
not the filename.  It seems to do the trick.

Thanks,

James Simmons

Tomeu Vizoso wrote:

>On Wed, Mar 19, 2008 at 9:43 PM, Michael Stone <michael at laptop.org> wrote:
>  
>
>>On Tue, Mar 18, 2008 at 09:18:05AM -0500, James Simmons wrote:
>> > how can I tell what kind of file I am receiving when
>> > someone shares a file with me?
>>
>> You might examine python's mimetypes module or the 'file' command.
>>    
>>
>
>I think you can also add that mime type to the tube's metadata and
>read it from the receiving side?
>
>Tomeu
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080319/26e3d3f0/attachment.html>


More information about the Devel mailing list