[Gllug] Python and Debian Sarge
Richard Cohen
richard at vmlinuz.org
Wed May 5 10:17:46 UTC 2004
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 :-)
> TIA
>
> Simon
>
> [0] http://docs.python.org/lib/email-unpack.txt
> [1] http://docs.python.org/lib/node510.html
Cheers
Richard
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list