[IronPython] platform.system() == "cli"

Curt Hagenlocher curt at hagenlocher.org
Thu Jan 8 23:28:49 CET 2009


On Thu, Jan 8, 2009 at 2:01 PM, Oren Held <oren at held.org.il> wrote:
>
> In my code, I have a section which is not cross platform, thus I'm checking
> the OS name to call the matching OS-specific calls.
>
> In all Unices, using platform.system() returned the OS name just fine. Is there
> a better way for getting the OS name on both CPython & IronPython?

IronPython is different enough from CPython on Win32 that it seems odd
to me for something to work under both, but to fail on IronPython
under Mono.

If you don't care about supporting Mono, you could say
    sys.platform in ('win32', 'cli').
If Mono support matters, then I don't know any straightforward way to
do this.  I think you could check for a platform of 'cli' and then
look at System.Environment.OSVersion.

--
Curt Hagenlocher
curt at hagenlocher.org



More information about the Ironpython-users mailing list