Writing cross-platform Python
At the time of writing, Python is supported on nearly a dozen operating system platforms, covering everything from common desktop systems like Windows to high-end commercial Unixes like AIX and obscure OS projects such as Haiku OS.
Across all these platforms, most Python code works without any significant alteration, as Python has been designed to translate high-level functionality into appropriate low-level operations on each system. Even so, there are situations where OS differences cannot be (or simply have not been) abstracted away, and careful handling is required to avoid platform-specific failures.
In this section, we'll look at some of the larger issues that impact cross-platform Python.
Filenames and file paths across platforms
Filesystems are probably the biggest source of pitfalls for cross-platform development. Although most platforms share the concept of files and directories arranged in a hierarchy, there are some crucial...