Re: How to figure out if the platform is 32bit or 64bit?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Manuel Vazquez Acosta

    #1

    Re: How to figure out if the platform is 32bit or 64bit?

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Just test for maxint value:

    from sys import maxint
    if maxint >33:
    print "more than 32 bits" # probably 64
    else:
    print "32 bits"


    Best regards,
    Manuel.

    Trent Mick wrote:
    norseman wrote:
    >>
    > I need to know if I'm running on 32bit or 64bit ... so far I haven't
    > come up with how to get this info via python. sys.platform returns
    > what python was built on ... but not what the current system is.
    >
    > I thought platform.uname( ) or just platform.proces sor() would have
    > done it, but python returns an empty string on windows. Any ideas?
    >
    If just for Windows I believe you can use the "PROCESSOR_ARCH ITECTURE"
    environment variable -- at least on NT-based Windows versions.
    >
    Values are x86 (32-bit), IA64 (64-bit) and AMD64 (64-bit).
    >
    Here is a "platinfo.p y" module that might help if you need to do this
    for other platforms:
    >

    >
    >
    Cheers,
    Trent
    >
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

    iEYEARECAAYFAki NU6IACgkQI2zpkm cEAhi6sACgo1ZyG KCWtnBPLXr1EjgS q3V4
    GEAAoL+zZStfGYa Zxg/zYoUqk6UFa+oM
    =g+tz
    -----END PGP SIGNATURE-----
Working...