sys.platform documentation?

"Martin v. Löwis" martin at v.loewis.de
Sun Aug 13 02:41:00 EDT 2006


Michiel Sikma schrieb:
> However, in order to populate the list of platforms, I need to know
> which strings sys.platform can return. I haven't found any documentation
> on this, but I guess that I'm not looking in the right places! Do any of
> you know where I can find a list of possible return values from
> sys.platform? I'll settle for a Python C source code file, too, if it
> contains strings.

As others have indicated, sys.platform is derived from the name that
the system vendor gives their system. However, Python also adds
plat-<sys.platform> to sys.path, so you can look at all the plat-*
directories in the Python distribution.

This gives you the list

aix3 aix4 atheos beos5 darwin freebsd2 freebsd3 freebsd4 freebsd5
freebsd6 freebsd7 generic irix5 irix6 linux2 mac netbsd1 next3 os2emx
riscos sunos5 unixware7

Of course, sys.platform can have additional values, when Python
gets compiled on a system for which no platform-specific directory
has been created.

Regads,
Martin



More information about the Python-list mailing list