[Tutor] Determine Filetype

admin at gg-lab.net admin at gg-lab.net
Sat Sep 19 14:35:49 CEST 2009


Hi All,

the solution was in the link i've posted before. If i use:

type = imghdr.what('img.test', image.data)

The imghdr modules ignore the filename (first argument) and takes the
second as a data stream assumed to contain the filetype.

The solution only works for images, but that's what i need. I think
that right now is not possible to generally determine the mimetype for
all types of files on GAE, because some libraries are missing. Anyway,
i'll send a mail to the gae mailing list, and if find a solution i'll
post it here.

Thankyou all guys.

2009/9/19 Sander Sweers <sander.sweers at gmail.com>:
> On Fri, 2009-09-18 at 16:48 -0400, Kent Johnson wrote:
>> > So, the __init__.py file of the GAE evinronment's ctypes library is
>> > broken, as it's importing from a package that doesn't exist. Right?
>>
>> Probably ctypes is not supported in GAE, that would be a pretty big
>> security hole.
>
> There is a pure python implementation on pypi [1]. It states it is in
> alpha and missing some features. Never used it myself though...
>
> Greets
> Sander
>
> [1] http://pypi.python.org/pypi/pymagic/0.1
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list