[Gllug] Python and Debian Sarge

Simon Perry gllug at si-designs.co.uk
Wed May 5 11:03:23 UTC 2004


Richard Cohen wrote:

>On Wed, 5 May 2004, Simon Perry wrote:
>
>  
>
>>Hi All,
>>
>>I have been using an example program[0] from the Pyhthon Library
>>Reference[1] to split email messages into their respective parts. On my
>>original system, running Debian Woody, the text part of any email passed
>>to the script would be correctly identified and given a .text extension.
>>However on my new system, running Debian Sarge, the text part seems to
>>be identified as a shell script and is given a .ksh extension. Anyone
>>got an idea why this is happening and how I can fix it?
>>    
>>
>
>Without having a clue as to the Debian situation, I'd guess your problem
>comes from these lines in the script:
>ext = mimetypes.guess_extension(part.get_type())
>if not ext:
>    # Use a generic bag-of-bits extension
>    ext = '.bin'
>
>Have a look at /etc/mime.types and/or ~/.mime.types and see if there's
>something in one of them which maps text/plain files to extension ksh - I
>don't think the mimetypes file is really mean to be used in that direction.
>Files which end in .ksh are almost certainly plain/text files, but
>plain/text files are very probably *not* ksh scripts :-)
>
>  
>
Thanks Richard,

I had a look at both mime.types files and the only reference for 
text/plain is in /etc/mime.types as below.
text/plain                    asc txt text diff pot

There is no mapping in either file for ksh at all. I will investigate 
the Python mimetypes package for any clues.

Simon

>>TIA
>>
>>Simon
>>
>>[0] http://docs.python.org/lib/email-unpack.txt
>>[1] http://docs.python.org/lib/node510.html
>>    
>>

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list