albertosottile / darkdetect

Detect OS Dark Mode from Python
Other
171 stars 18 forks source link

Avoid ValueError on Windows Server (and others) #21

Closed PierreRaybaut closed 2 years ago

PierreRaybaut commented 2 years ago

This changes avoids throwing a ValueError when trying to convert platform.release() into an integer (platform.release() does not necessarily return an integer: on Windows Server 2008 R2, it returns '2008ServerR2' for example).

albertosottile commented 2 years ago

Hi, thanks for your contribution. This would indeed solve the ValueError, but it would not allow darkdetect to work on e.g. Windows Server 2008 R2. Is this acceptable for you?

PierreRaybaut commented 2 years ago

Absolutely because there is no dark mode on Windows Server 2008 anyway. Actually, because the same software using darkdetect is deployed on Windows machines supporting dark mode (e.g. Windows 10) and others (e.g. Windows 7 or Server 2008), we just need darkdetect to do nothing if dark mode is not supported.