Generic Operating System Services
From Python 2.6
Generic Operating System Services
The modules described in this chapter provide interfaces to operating system features that are available on (almost) all operating systems, such as files and a clock. The interfaces are generally modeled after the Unix or C interfaces, but they are available on most other systems as well. Here’s an overview:
- optparse — More powerful command line option parser
- Background
- Tutorial
- Reference Guide
- Option Callbacks
- Defining a callback option
- How callbacks are called
- Raising errors in a callback
- Callback example 1: trivial callback
- Callback example 2: check option order
- Callback example 3: check option order (generalized)
- Callback example 4: check arbitrary condition
- Callback example 5: fixed arguments
- Callback example 6: variable arguments
- Extending optparse
- logging — Logging facility for Python
- Logging tutorial
- Logging Levels
- Logger Objects
- Basic example
- Logging to multiple destinations
- Adding contextual information to your logging output
- Sending and receiving logging events across a network
- Handler Objects
- Formatter Objects
- Filter Objects
- LogRecord Objects
- LoggerAdapter Objects
- Thread Safety
- Configuration
- More examples
- curses — Terminal handling for character-cell displays
- curses.textpad — Text input widget for curses programs
- curses.wrapper — Terminal handler for curses programs
- ctypes — A foreign function library for Python.
- ctypes tutorial
- Loading dynamic link libraries
- Accessing functions from loaded dlls
- Calling functions
- Fundamental data types
- Calling functions, continued
- Calling functions with your own custom data types
- Specifying the required argument types (function prototypes)
- Return types
- Passing pointers (or: passing parameters by reference)
- Structures and unions
- Structure/union alignment and byte order
- Bit fields in structures and unions
- Arrays
- Pointers
- Type conversions
- Incomplete Types
- Callback functions
- Accessing values exported from dlls
- Surprises
- Variable-sized data types
- ctypes reference
- ctypes tutorial