Skip to Content
Python: Essential Reference, Third Edition
book

Python: Essential Reference, Third Edition

by David Beazley
February 2006
Intermediate to advanced content levelIntermediate to advanced
648 pages
14h 53m
English
Sams
Content preview from Python: Essential Reference, Third Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python: Essential Reference

Python: Essential Reference

David M. Beazley

Publisher Resources

ISBN: 0672328623Purchase book