Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reliably detect Windows in Python

I'm working on a couple of Linux tools and need to prevent installation on Windows, since it depends on FHS and is thus rendered useless on that platform. The platform.platform function comes close but only returns a string.

Unfortunately I don't know what to search for in that string for it to yield a reliable result. Does anyone know what to search for or does anyone know of another function that I'm missing here?

like image 844
blokkie Avatar asked Sep 07 '09 01:09

blokkie


1 Answers

>>> import platform >>> platform.system() 'Windows' 
like image 71
Matthew Iselin Avatar answered Sep 30 '22 01:09

Matthew Iselin