I'm trying to determine if the operating system is Unix-based from a Python script. I can think of two ways to do this but both of them have disadvantages:
- Check if
platform.system()
is in a tuple such as("Linux", "Darwin")
. The problem with this is that I don't want to provide a list of every Unix-like system every made, in particular there are many *BSD varieties. - Check if the function
os.fchmod
exists, as this function is only available on Unix. This doesn't seem like a clean or "Pythonic" way to do it.