mimedecode 2.9
mimedecode
WHAT IS IT
Mail users, especially in non-English countries, often find that mail
messages arrived in different formats, with different content types, in
different encodings and charsets. Usually this is good because it allows
us to use appropriate format/encoding/whatever. Sometimes, though, some
unification is desirable. For example, one may want to put mail messages
into an archive, make HTML indices, run search indexer, etc. In such
situations converting messages to text in one character set and skipping
some binary attachments is much desirable.
Here is the solution - mimedecode.
This is a program to decode MIME messages. The program expects one
input file (either on command line or on stdin) which is treated as an
RFC822 message, and decodes to stdout or an output file. If the file is
not an RFC822 message it is just copied to the output one-to-one. If the
file is a simple RFC822 message it is decoded as one part. If it is a
MIME message with multiple parts ("attachments") all parts are decoded.
Decoding can be controlled by command-line options.
Think about said mail archive; for example, its maintainer wants to
put there only texts, convert PDF/Postscript to text, pass HTML and
images decoding base64 to html but leaving images encoded, and ignore
everything else. This is how it could be done:
mimedecode -t application/pdf -t application/postscript -t text/plain -b
text/html -B 'image/*' -i '*/*'
Version 2.9.0 (2017-12-12)
Split mimedecode.py into mimedecode library and a small script.
Made the library executable via ``python -m mimedecode``.
Version 2.8.0 (2017-11-03)
Python 3.
Stop supporting Python 2.6.
WHERE TO GET
Home page: http://phdru.name/Software/Python/#mimedecode
git clone https://github.com/phdru/mimedecode.git
git clone http://git.phdru.name/mimedecode.git
git clone git://git.phdru.name/mimedecode.git
Requires: Python 2.7 or Python 3.3+, m_lib.defenc 1.0+.
Tests require: tox, m_lib 3.1+.
Recommends: configured mailcap database.
Documentation: http://phdru.name/Software/Python/mimedecode.html
(also included in the package in html, man and txt formats).
AUTHOR
Oleg Broytman
COPYRIGHT
Copyright (C) 2001-2017 PhiloSoft Design.
LICENSE
GPL
Oleg.
--
Oleg Broytmanhttp://phdru.name/[email protected]
Programmers don't die, they just GOSUB without RETURN.
--
https://mail.python.org/mailman/listinfo/python-list
Re: request fails on wikipedia (https) - certificate verify failed (_ssl.c:748)
On 2017-12-11, F Massion wrote: > ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed > (_ssl.c:748) Try `pip install certifi` -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Chris Angelico wrote: [...] > > Yeah… magic… in the category of mind-reading? sooth- > > saying? > > Which is why OS/2, back in the 1990s, had *multiple* > associations for any given file. You could use file types > (sadly not MIME types - this was before MIME was the one > obvious standard to use) to identify *any number* of > programs that are likely to be used with a file, and then > one of them is the global default. For any specific file, > you can change which program is its own default, and even > add specific associations for that individual file. When > you double-click, you get the default; if you right-click > and choose "Open", you could pick from the associated > programs. A good system, and one that I still haven't seen > replicated in a mainstream OS. Windows has the same features. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
Rustom Mody wrote: > This thread is getting like a mini hologram of our current > surreal time If we can put aside who is right and wrong > for a moment we see the more frightening spectacle that > Repubs and democrats, Remainers and Brexiters and so on all > over by getting more and more shrill are not talking to > each other but past each other I blame the confirmation bias of social media for the current state of dissed-discourse we find ourselves in these days. > > [Rick Johnson wrote] > > A file with no extension (regardless of the OS or desktop > > enviroment that it was created on), is like a sealed box > > with no label to indicate the contents. > > So to Rick: Not if you use something like file (magic) My > (unschooled) estimate is it gets its detection right 80% of > the time But this suggestion misses my point entirely. And the point is, we shouldn't have to pick-up the "box" (aka: file) and shake it (ook-ook) just to "intuit" what is inside. Using file extentions (aka: labels) solves this semantical problem much more elegantly. Now, is a perfect solution? Of course not! However, it is the most practical solution. > And to Chris and others who think file(magic) is a > replacement for file-associations. Even assuming that magic > works 100% : > Say I have an html file. > That means its ALSO a text file. > So its equally legitimate to set defaults to use: > - a plain text editor (of which there are hundreds) > - to open it in browser of choice (also plural nowadays) > - some sort of html composer > - etc > > Which means we are beyond the nature of the file per se to > the pattern of its usage And although an automated "intuitor" could easily determine if a file contained a markup language, we would still be force to "shake the box" by running it. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson wrote: > Chris Angelico wrote: > > [...] > >> > Yeah… magic… in the category of mind-reading? sooth- >> > saying? >> >> Which is why OS/2, back in the 1990s, had *multiple* >> associations for any given file. You could use file types >> (sadly not MIME types - this was before MIME was the one >> obvious standard to use) to identify *any number* of >> programs that are likely to be used with a file, and then >> one of them is the global default. For any specific file, >> you can change which program is its own default, and even >> add specific associations for that individual file. When >> you double-click, you get the default; if you right-click >> and choose "Open", you could pick from the associated >> programs. A good system, and one that I still haven't seen >> replicated in a mainstream OS. > > Windows has the same features. It does? Show me how to specify that one file - which might have the exact same name as many similar files - should be associated with a different program than the one its name would normally suggest. Show me how to identify multiple file types for a given file, independently of its filename. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tue, 12 Dec 2017 05:52:41 -0800, Rick Johnson wrote: > Rustom Mody wrote: >> This thread is getting like a mini hologram of our current surreal time >> If we can put aside who is right and wrong for a moment we see the >> more frightening spectacle that Repubs and democrats, Remainers and >> Brexiters and so on all over by getting more and more shrill are not >> talking to each other but past each other > > I blame the confirmation bias of social media for the current state of > dissed-discourse we find ourselves in these days. > >> > [Rick Johnson wrote] >> > A file with no extension (regardless of the OS or desktop enviroment >> > that it was created on), is like a sealed box with no label to >> > indicate the contents. >> >> So to Rick: Not if you use something like file (magic) My (unschooled) >> estimate is it gets its detection right 80% of the time > > But this suggestion misses my point entirely. And the point is, we > shouldn't have to pick-up the "box" (aka: file) and shake it (ook-ook) > just to "intuit" what is inside. Using file extentions (aka: labels) > solves this semantical problem much more elegantly. Now, is a perfect > solution? Of course not! However, it is the most practical solution. > >> And to Chris and others who think file(magic) is a replacement for >> file-associations. Even assuming that magic works 100% : >> Say I have an html file. >> That means its ALSO a text file. >> So its equally legitimate to set defaults to use: >> - a plain text editor (of which there are hundreds) >> - to open it in browser of choice (also plural nowadays) >> - some sort of html composer - etc >> >> Which means we are beyond the nature of the file per se to the pattern >> of its usage > > And although an automated "intuitor" could easily determine if a file > contained a markup language, we would still be force to "shake the box" > by running it. Back to the original problem has the execute bit been set on the file? -- All Hell hadn't been let loose. It was merely Detritus. But from a few feet away you couldn't tell the difference. (The Fifth Elephant) -- https://mail.python.org/mailman/listinfo/python-list
Re: request fails on wikipedia (https) - certificate verify failed (_ssl.c:748)
Am Dienstag, 12. Dezember 2017 14:33:42 UTC+1 schrieb Jon Ribbens: > On 2017-12-11, F Massion wrote: > > ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed > > (_ssl.c:748) > > Try `pip install certifi` certifi was installed. If I make the following changes I do not have the error message. I don't understand why, but this makes a difference: #import requests --> import urllib.request url = 'https://en.wikipedia.org/wiki/Stethoscope' #res = requests.get(url) --> res = urllib.request.urlopen(url).read() -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Tue, Dec 12, 2017 at 3:30 PM, Chris Angelico wrote: > On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson > wrote: >> Chris Angelico wrote: >> >>> Which is why OS/2, back in the 1990s, had *multiple* >>> associations for any given file. You could use file types >>> (sadly not MIME types - this was before MIME was the one >>> obvious standard to use) to identify *any number* of >>> programs that are likely to be used with a file, and then >>> one of them is the global default. For any specific file, >>> you can change which program is its own default, and even >>> add specific associations for that individual file. When >>> you double-click, you get the default; if you right-click >>> and choose "Open", you could pick from the associated >>> programs. A good system, and one that I still haven't seen >>> replicated in a mainstream OS. >> >> Windows has the same features. > > It does? Show me how to specify that one file - which might have the > exact same name as many similar files - should be associated with a > different program than the one its name would normally suggest. Show > me how to identify multiple file types for a given file, independently > of its filename. AFAIK that's not currently possible in Windows -- at least not without writing a custom shell extension. Hypothetically, the shell could support something like this on NTFS drives by storing a perceived type (e.g. text, audio, image, video) and lists of ProgIDs (e.g. txtfile, mp3file, jpegfile, mpegfile) either in a file's extended attributes (EAs) or an alternate data stream. I think OS/2 used EAs to store file associations. It's too bad NT's FAT32 doesn't support EAs (unlike FAT16 on NT, which needed them for the OS/2 subsystem) or alternate data streams. So an unobtrusive, decentralized approach that works automatically with existing backup software isn't feasible with FAT32 drives. That said, I don't see this feature as being very useful compared to just using "open with" when I occasionally need to open a file with a non-default program. -- https://mail.python.org/mailman/listinfo/python-list
Re: Please tell me how to execute python file in Ubuntu by double
On Wed, Dec 13, 2017 at 3:41 PM, eryk sun wrote: > On Tue, Dec 12, 2017 at 3:30 PM, Chris Angelico wrote: >> On Wed, Dec 13, 2017 at 12:54 AM, Rick Johnson >> wrote: >>> Chris Angelico wrote: >>> Which is why OS/2, back in the 1990s, had *multiple* associations for any given file. You could use file types (sadly not MIME types - this was before MIME was the one obvious standard to use) to identify *any number* of programs that are likely to be used with a file, and then one of them is the global default. For any specific file, you can change which program is its own default, and even add specific associations for that individual file. When you double-click, you get the default; if you right-click and choose "Open", you could pick from the associated programs. A good system, and one that I still haven't seen replicated in a mainstream OS. >>> >>> Windows has the same features. >> >> It does? Show me how to specify that one file - which might have the >> exact same name as many similar files - should be associated with a >> different program than the one its name would normally suggest. Show >> me how to identify multiple file types for a given file, independently >> of its filename. > > AFAIK that's not currently possible in Windows -- at least not without > writing a custom shell extension. Hypothetically, the shell could > support something like this on NTFS drives by storing a perceived type > (e.g. text, audio, image, video) and lists of ProgIDs (e.g. txtfile, > mp3file, jpegfile, mpegfile) either in a file's extended attributes > (EAs) or an alternate data stream. I think OS/2 used EAs to store file > associations. It's too bad NT's FAT32 doesn't support EAs (unlike > FAT16 on NT, which needed them for the OS/2 subsystem) or alternate > data streams. So an unobtrusive, decentralized approach that works > automatically with existing backup software isn't feasible with FAT32 > drives. Yeah, EAs were used for custom file associations and the "use that one as the default for this file" custom default. But honestly, who cares about FAT32? If the means of achieving this requires a better file system, eg NTFS or ext4, that's not much of a cost. > That said, I don't see this feature as being very useful compared to > just using "open with" when I occasionally need to open a file with a > non-default program. I used to often have a text executable associated with two or three things - "run", an editor, and maybe some ancillary tool like CASBuild. All files of that type would be associated with the same three targets, but for one, I might have double click do a regular run, but for another, I might always want it to go to CASBuild. Or perhaps a GUI application might be associated with the VX-REXX "run script" launcher rather than the regular console. A Windows equivalent would be to have a .py file associated normally with the regular console, but some individual ones associated with pythonw.exe - without renaming them to .pyw. AFAIK there is no way to do this on Windows short of renaming the files. ChrisA -- https://mail.python.org/mailman/listinfo/python-list
