O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

binhex

The binhex module is used to encode and decode files in binhex 4, a format commonly used when transferring files on older Macintosh systems.

binhex(input, output)

Converts a binary file with name input to a binhex file. output is a filename or an open file-like object that supports the write() and close() methods.

hexbin(input
						[,
						output])

Decodes a binhex file. input is either a filename or a file-like object with read() and close() methods. output is the name of the output file. If omitted, the output name is taken from the binhex file.

Exceptions

Error

Raised when data can’t be encoded as binhex format or when input can’t be properly decoded.

Notes

  • Both the data and resource forks are handled on the Macintosh.

  • Only the data fork is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required