FAQ
Hello,
how can I determine the architecture (32 or 64bit) with python 2.2 on
Windows or Unix (AIX, Solaris) OS, without the modul platform?
Thanks for your hints, Kai

Search Discussions

  • John Machin at Jun 19, 2007 at 12:28 pm

    On Jun 19, 9:17 pm, Kai Rosenthal wrote:
    Hello,
    how can I determine the architecture (32 or 64bit) with python 2.2 on
    Windows or Unix (AIX, Solaris) OS, without the modul platform?
    Thanks for your hints, Kai
    What happens when you fire up a 64-bit Python and type
    import sys; sys.maxint
    at it?
  • David Rushby at Jun 19, 2007 at 2:31 pm

    On Jun 19, 4:28 pm, John Machin wrote:
    On Jun 19, 9:17 pm, Kai Rosenthal wrote:

    Hello,
    how can I determine the architecture (32 or 64bit) with python 2.2 on
    Windows or Unix (AIX, Solaris) OS, without the modul platform?
    Thanks for your hints, Kai
    What happens when you fire up a 64-bit Python and type
    import sys; sys.maxint
    at it?
    That's not suitable, because of the differences between LP64 and LLP64
    (http://en.wikipedia.org/wiki/64-bit#64-bit_data_models ).

    Try
    python -c "import struct; print struct.calcsize('P')"
    instead. That calculates the size of a pointer.
  • Lenard Lindstrom at Jun 19, 2007 at 10:22 pm

    David Rushby wrote:
    On Jun 19, 4:28 pm, John Machin wrote:
    On Jun 19, 9:17 pm, Kai Rosenthal wrote:

    Hello,
    how can I determine the architecture (32 or 64bit) with python 2.2 on
    Windows or Unix (AIX, Solaris) OS, without the modul platform?
    Thanks for your hints, Kai
    What happens when you fire up a 64-bit Python and type
    import sys; sys.maxint
    at it?
    That's not suitable, because of the differences between LP64 and LLP64
    (http://en.wikipedia.org/wiki/64-bit#64-bit_data_models ).

    Try
    python -c "import struct; print struct.calcsize('P')"
    instead. That calculates the size of a pointer.
    How about:

    tuple.__itemsize__

    since each tuple item is a pointer.

    --
    Lenard Lindstrom
    <len-l at telus.net>
  • Martin v. Löwis at Jun 20, 2007 at 5:14 am

    What happens when you fire up a 64-bit Python and type
    import sys; sys.maxint
    at it?
    That's not suitable, because of the differences between LP64 and LLP64
    (http://en.wikipedia.org/wiki/64-bit#64-bit_data_models ).
    For the systems that the OP mentioned, sys.maxint is just fine:
    AIX and Solaris both use LP64, and Windows is 32-bit only for
    Python 2.2.

    Regards,
    Martin
  • Martin v. Löwis at Jun 20, 2007 at 5:12 am

    Kai Rosenthal schrieb:
    how can I determine the architecture (32 or 64bit) with python 2.2 on
    Windows or Unix (AIX, Solaris) OS, without the modul platform?
    On Windows, the architecture is always 32-bit, as Python 2.2 does not
    support Win64. On Unix, looking for sys.maxint is enough for AIX
    and Solaris.

    Regards,
    Martin
  • Evan Klitzke at Jun 20, 2007 at 5:22 am

    On 6/19/07, Kai Rosenthal wrote:
    Hello,
    how can I determine the architecture (32 or 64bit) with python 2.2 on
    Windows or Unix (AIX, Solaris) OS, without the modul platform?
    Thanks for your hints, Kai
    For Unix systems you can probably use os.uname() and check what
    architecture the kernel is built for. For example,

    evan at thinkpad ~ $ python -c 'import os; print os.uname()[4]'
    i686

    As you can see, I'm on a 32 bit system.

    --
    Evan Klitzke <evan at yelp.com>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJun 19, '07 at 11:17a
activeJun 20, '07 at 5:22a
posts7
users6
websitepython.org

People

Translate

site design / logo © 2022 Grokbase