os.name under Win32
"Martin v. Löwis"
martin at v.loewis.de
Wed Sep 13 11:44:35 EDT 2006
Igor Kravtchenko schrieb:
> Recently, someone advised me to use instead:
> platform.system()
>
> that returns only 3 different strings: Java, Linux or Windows. End of
> story.
That's not true:
ActivePython 2.4.1 Build 247 (ActiveState Corp.) based on
Python 2.4.1 (#1, Jun 20 2005, 17:18:51) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.system()
'SunOS'
In any case, the platform module is a more recent addition to Python;
so code using it may not work on older installations (unless you
ship the platform module with your application).
> Is this not supposed to work better than sys.platform?
> Indeed I'm pretty worried about having "win64" returned on further os
> like Windows Vista and having our tests failing again.
It won't. On Win64, sys.platform is still win32.
Regards,
Martin
More information about the Python-list
mailing list