binhex — Encode and decode binhex4 files

Source code:Lib/binhex.py

Deprecated since version 3.9.


This module encodes and decodes files in binhex4 format, a format allowingrepresentation of Macintosh files in ASCII. Only the data fork is handled.

Thebinhex module defines the following functions:

binhex.binhex(input,output)

Convert a binary file with filenameinput to binhex fileoutput. Theoutput parameter can either be a filename or a file-like object (any objectsupporting awrite() andclose() method).

binhex.hexbin(input,output)

Decode a binhex fileinput.input may be a filename or a file-like objectsupportingread() andclose() methods. The resulting file is writtento a file namedoutput, unless the argument isNone in which case theoutput filename is read from the binhex file.

The following exception is also defined:

exceptionbinhex.Error

Exception raised when something can’t be encoded using the binhex format (forexample, a filename is too long to fit in the filename field), or when input isnot properly encoded binhex data.

See also

Modulebinascii

Support module containing ASCII-to-binary and binary-to-ASCII conversions.

Notes

There is an alternative, more powerful interface to the coder and decoder, seethe source for details.

If you code or decode textfiles on non-Macintosh platforms they will still usethe old Macintosh newline convention (carriage-return as end of line).