<!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN">
<link rel=
"STYLESHEET" href=
"lib.css" type='text/css'
/>
<link rel=
"SHORTCUT ICON" href=
"../icons/pyfav.png" type=
"image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index'
/>
<link rel=
"first" href=
"lib.html" title='Python Library Reference'
/>
<link rel='contents' href='contents.html'
title=
"Contents" />
<link rel='index' href='genindex.html' title='Index'
/>
<link rel='last' href='about.html' title='About this document...'
/>
<link rel='help' href='about.html' title='About this document...'
/>
<link rel=
"next" href=
"node366.html" />
<link rel=
"prev" href=
"module-platform.html" />
<link rel=
"parent" href=
"module-platform.html" />
<link rel=
"next" href=
"node366.html" />
<meta name='aesop' content='information'
/>
<title>6.30.1 Cross Platform
</title>
<div id='top-navigation-panel' xml:id='top-navigation-panel'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"6.30 platform "
href=
"module-platform.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"6.30 platform "
href=
"module-platform.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"6.30.2 Java Platform"
href=
"node366.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-platform.html">6.30 platform
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-platform.html">6.30 platform
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"node366.html">6.30.2 Java Platform
</A>
<!--End of Navigation Panel-->
<H2><A NAME=
"SECTION0083010000000000000000">
6.30.1 Cross Platform
</A>
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2567' xml:id='l2h-
2567'
class=
"function">architecture
</tt></b>(
</nobr></td>
<td><var>executable=sys.executable, bits='', linkage=''
</var>)
</td></tr></table></dt>
Queries the given executable (defaults to the Python interpreter
binary) for various architecture information.
Returns a tuple
<code>(bits, linkage)
</code> which contain information about
the bit architecture and the linkage format used for the
executable. Both values are returned as strings.
Values that cannot be determined are returned as given by the
parameter presets. If bits is given as
<code>''
</code>, the
<tt class=
"cfunction">sizeof(pointer)
</tt>
(or
<tt class=
"cfunction">sizeof(long)
</tt> on Python version
< 1.5.2) is used as
indicator for the supported pointer size.
The function relies on the system's
<span class=
"file">file
</span> command to do the
actual work. This is available on most if not all
<span class=
"Unix">Unix
</span>
platforms and some non-
<span class=
"Unix">Unix
</span> platforms and then only if the
executable points to the Python interpreter. Reasonable defaults
are used when the above needs are not met.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2568' xml:id='l2h-
2568'
class=
"function">machine
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the machine type, e.g.
<code>'i386'
</code>.
An empty string is returned if the value cannot be determined.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2569' xml:id='l2h-
2569'
class=
"function">node
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the computer's network name (may not be fully qualified!).
An empty string is returned if the value cannot be determined.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2570' xml:id='l2h-
2570'
class=
"function">platform
</tt></b>(
</nobr></td>
<td><var>aliased=
0, terse=
0</var>)
</td></tr></table></dt>
Returns a single string identifying the underlying platform
with as much useful information as possible.
The output is intended to be
<em>human readable
</em> rather than
machine parseable. It may look different on different platforms and
If
<var>aliased
</var> is true, the function will use aliases for various
platforms that report system names which differ from their common
names, for example SunOS will be reported as Solaris. The
<tt class=
"function">system_alias()
</tt> function is used to implement this.
Setting
<var>terse
</var> to true causes the function to return only the
absolute minimum information needed to identify the platform.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2571' xml:id='l2h-
2571'
class=
"function">processor
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the (real) processor name, e.g.
<code>'amdk6'
</code>.
An empty string is returned if the value cannot be determined. Note
that many platforms do not provide this information or simply return
the same value as for
<tt class=
"function">machine()
</tt>. NetBSD does this.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2572' xml:id='l2h-
2572'
class=
"function">python_build
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns a tuple
<code>(
<var>buildno
</var>,
<var>builddate
</var>)
</code> stating the
Python build number and date as strings.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2573' xml:id='l2h-
2573'
class=
"function">python_compiler
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns a string identifying the compiler used for compiling Python.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2574' xml:id='l2h-
2574'
class=
"function">python_version
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the Python version as string
<code>'major.minor.patchlevel'
</code>
Note that unlike the Python
<code>sys.version
</code>, the returned value
will always include the patchlevel (it defaults to
0).
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2575' xml:id='l2h-
2575'
class=
"function">python_version_tuple
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the Python version as tuple
<code>(
<var>major
</var>,
<var>minor
</var>,
<var>patchlevel
</var>)
</code> of strings.
Note that unlike the Python
<code>sys.version
</code>, the returned value
will always include the patchlevel (it defaults to
<code>'
0'
</code>).
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2576' xml:id='l2h-
2576'
class=
"function">release
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the system's release, e.g.
<code>'
2.2.0'
</code> or
<code>'NT'
</code>
An empty string is returned if the value cannot be determined.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2577' xml:id='l2h-
2577'
class=
"function">system
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the system/OS name, e.g.
<code>'Linux'
</code>,
<code>'Windows'
</code>,
An empty string is returned if the value cannot be determined.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2578' xml:id='l2h-
2578'
class=
"function">system_alias
</tt></b>(
</nobr></td>
<td><var>system, release, version
</var>)
</td></tr></table></dt>
Returns
<code>(
<var>system
</var>,
<var>release
</var>,
<var>version
</var>)
</code> aliased
to common marketing names used for some systems. It also does some
reordering of the information in some cases where it would otherwise
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2579' xml:id='l2h-
2579'
class=
"function">version
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Returns the system's release version, e.g.
<code>'#
3 on degas'
</code>.
An empty string is returned if the value cannot be determined.
<dl><dt><table cellpadding=
"0" cellspacing=
"0"><tr valign=
"baseline">
<td><nobr><b><tt id='l2h-
2580' xml:id='l2h-
2580'
class=
"function">uname
</tt></b>(
</nobr></td>
<td><var></var>)
</td></tr></table></dt>
Fairly portable uname interface. Returns a tuple of strings
<code>(
<var>system
</var>,
<var>node
</var>,
<var>release
</var>,
<var>version
</var>,
<var>machine
</var>,
<var>processor
</var>)
</code> identifying the underlying
Note that unlike the
<tt class=
"function">os.uname()
</tt> function this also returns
possible processor information as additional tuple entry.
Entries which cannot be determined are set to
<code>''
</code>.
<div class='online-navigation'
>
<table align=
"center" width=
"100%" cellpadding=
"0" cellspacing=
"2">
<td class='online-navigation'
><a rel=
"prev" title=
"6.30 platform "
href=
"module-platform.html"><img src='../icons/previous.png'
border='
0' height='
32' alt='Previous Page' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"parent" title=
"6.30 platform "
href=
"module-platform.html"><img src='../icons/up.png'
border='
0' height='
32' alt='Up One Level' width='
32'
/></A></td>
<td class='online-navigation'
><a rel=
"next" title=
"6.30.2 Java Platform"
href=
"node366.html"><img src='../icons/next.png'
border='
0' height='
32' alt='Next Page' width='
32'
/></A></td>
<td align=
"center" width=
"100%">Python Library Reference
</td>
<td class='online-navigation'
><a rel=
"contents" title=
"Table of Contents"
href=
"contents.html"><img src='../icons/contents.png'
border='
0' height='
32' alt='Contents' width='
32'
/></A></td>
<td class='online-navigation'
><a href=
"modindex.html" title=
"Module Index"><img src='../icons/modules.png'
border='
0' height='
32' alt='Module Index' width='
32'
/></a></td>
<td class='online-navigation'
><a rel=
"index" title=
"Index"
href=
"genindex.html"><img src='../icons/index.png'
border='
0' height='
32' alt='Index' width='
32'
/></A></td>
<div class='online-navigation'
>
<b class=
"navlabel">Previous:
</b>
<a class=
"sectref" rel=
"prev" href=
"module-platform.html">6.30 platform
</A>
<b class=
"navlabel">Up:
</b>
<a class=
"sectref" rel=
"parent" href=
"module-platform.html">6.30 platform
</A>
<b class=
"navlabel">Next:
</b>
<a class=
"sectref" rel=
"next" href=
"node366.html">6.30.2 Java Platform
</A>
<span class=
"release-info">Release
2.4.2, documentation updated on
28 September
2005.
</span>
<!--End of Navigation Panel-->
See
<i><a href=
"about.html">About this document...
</a></i> for information on suggesting changes.