Platform detection?

I have a song where I’ve set up some tracks specifically as MIDI-out signals. I’m using it to drive an animation. At different times, for various reasons, I play the song on either Ubuntu, Windows, or OSX.

Naturally, the names of the internal MIDI devices are different for each platform, This means when i open the song on OSX I need to update the instrument MIDI assignments. Later, if I’m working with it on Windows I have to re-do them, and so on.

I thinking of writing a script (a dedicated tool, basically) to automate this. I’d like the script to detect the operating system and/or the machine name and then handle the MIDI instrument assignments.

Has someone already solved this for a Renoise tool?

There are a few approaches I can take (for example: although uname -o happens to fail on OSX 10.8) but maybe there’s something cleaner.

You can use os.platform:

You can use os.platform:

Oh, perfect, thank you.