Writing cross-platform Python
At the time of writing, Python is supported on over three dozen operating system platforms, covering everything from common desktop systems like Windows to high-end commercial Unixes to obscure OS projects such as Haiku or AROS Research Operating System. 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 one. 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 filepaths 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 differences...