16. 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:
- 16.1.
os
— Miscellaneous operating system interfaces- 16.1.1. File Names, Command Line Arguments, and Environment Variables
- 16.1.2. Process Parameters
- 16.1.3. File Object Creation
- 16.1.4. File Descriptor Operations
- 16.1.5. Files and Directories
- 16.1.6. Process Management
- 16.1.7. Interface to the scheduler
- 16.1.8. Miscellaneous System Information
- 16.1.9. Miscellaneous Functions
- 16.2.
io
— Core tools for working with streams - 16.3.
time
— Time access and conversions - 16.4.
argparse
— Parser for command-line options, arguments and sub-commands - 16.5.
optparse
— Parser for command line options- 16.5.1. Background
- 16.5.2. Tutorial
- 16.5.3. Reference Guide
- 16.5.3.1. Creating the parser
- 16.5.3.2. Populating the parser
- 16.5.3.3. Defining options
- 16.5.3.4. Option attributes
- 16.5.3.5. Standard option actions
- 16.5.3.6. Standard option types
- 16.5.3.7. Parsing arguments
- 16.5.3.8. Querying and manipulating your option parser
- 16.5.3.9. Conflicts between options
- 16.5.3.10. Cleanup
- 16.5.3.11. Other methods
- 16.5.4. Option Callbacks
- 16.5.4.1. Defining a callback option
- 16.5.4.2. How callbacks are called
- 16.5.4.3. Raising errors in a callback
- 16.5.4.4. Callback example 1: trivial callback
- 16.5.4.5. Callback example 2: check option order
- 16.5.4.6. Callback example 3: check option order (generalized)
- 16.5.4.7. Callback example 4: check arbitrary condition
- 16.5.4.8. Callback example 5: fixed arguments
- 16.5.4.9. Callback example 6: variable arguments
- 16.5.5. Extending
optparse
- 16.6.
getopt
— C-style parser for command line options - 16.7.
logging
— Logging facility for Python- 16.7.1. Logger Objects
- 16.7.2. Logging Levels
- 16.7.3. Handler Objects
- 16.7.4. Formatter Objects
- 16.7.5. Filter Objects
- 16.7.6. LogRecord Objects
- 16.7.7. LogRecord attributes
- 16.7.8. LoggerAdapter Objects
- 16.7.9. Thread Safety
- 16.7.10. Module-Level Functions
- 16.7.11. Module-Level Attributes
- 16.7.12. Integration with the warnings module
- 16.8.
logging.config
— Logging configuration - 16.9.
logging.handlers
— Logging handlers- 16.9.1. StreamHandler
- 16.9.2. FileHandler
- 16.9.3. NullHandler
- 16.9.4. WatchedFileHandler
- 16.9.5. BaseRotatingHandler
- 16.9.6. RotatingFileHandler
- 16.9.7. TimedRotatingFileHandler
- 16.9.8. SocketHandler
- 16.9.9. DatagramHandler
- 16.9.10. SysLogHandler
- 16.9.11. NTEventLogHandler
- 16.9.12. SMTPHandler
- 16.9.13. MemoryHandler
- 16.9.14. HTTPHandler
- 16.9.15. QueueHandler
- 16.9.16. QueueListener
- 16.10.
getpass
— Portable password input - 16.11.
curses
— Terminal handling for character-cell displays - 16.12.
curses.textpad
— Text input widget for curses programs - 16.13.
curses.ascii
— Utilities for ASCII characters - 16.14.
curses.panel
— A panel stack extension for curses - 16.15.
platform
— Access to underlying platform’s identifying data - 16.16.
errno
— Standard errno system symbols - 16.17.
ctypes
— A foreign function library for Python- 16.17.1. ctypes tutorial
- 16.17.1.1. Loading dynamic link libraries
- 16.17.1.2. Accessing functions from loaded dlls
- 16.17.1.3. Calling functions
- 16.17.1.4. Fundamental data types
- 16.17.1.5. Calling functions, continued
- 16.17.1.6. Calling functions with your own custom data types
- 16.17.1.7. Specifying the required argument types (function prototypes)
- 16.17.1.8. Return types
- 16.17.1.9. Passing pointers (or: passing parameters by reference)
- 16.17.1.10. Structures and unions
- 16.17.1.11. Structure/union alignment and byte order
- 16.17.1.12. Bit fields in structures and unions
- 16.17.1.13. Arrays
- 16.17.1.14. Pointers
- 16.17.1.15. Type conversions
- 16.17.1.16. Incomplete Types
- 16.17.1.17. Callback functions
- 16.17.1.18. Accessing values exported from dlls
- 16.17.1.19. Surprises
- 16.17.1.20. Variable-sized data types
- 16.17.2. ctypes reference
- 16.17.1. ctypes tutorial