May 2001
Intermediate to advanced
304 pages
6h 12m
English
(Obsolete) The packmail module contains tools to create Unix shell archives. If you have the right tools installed (if you have
a Unix box, they are installed), you can unpack such an archive simply
by executing it. Example 6-10 shows how to pack a single file using packmail, while Example 6-11 shows how the module can pack an entire directory tree.
Example 6-10. Using the packmail Module to Pack a Single File
File: packmail-example-1.py import packmail import sys packmail.pack(sys.stdout, "samples/sample.txt", "sample.txt")echo sample.txtsed "s/^X//" >sample.txt <<"!"XWe will perhaps eventually be writing only smallXmodules, which are identified by name as they areXused to build larger ones, so that devices likeXindentation, rather than delimiters, might becomeXfeasible for expressing local structure in theXsource language.X -- Donald E. Knuth, December 1974!
Example 6-11. Using the packmail Module to Pack an Entire Directory Tree
File: packmail-example-2.py import packmail import sys packmail.packtree(sys.stdout, "samples")
Note that this module cannot handle binary files, such as sound snippets and images.
Read now
Unlock full access