469,936 Members | 2,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

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

Gary Josack wrote:
Trent Mick wrote:
>Manuel Vazquez Acosta wrote:
>>-----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"

I believe that was already suggested in this thread. That test will
just tell you if the Python *build* is 32-bit or 64-bit. If the answer
is 32-bit, then that doesn't tell you if this is a 32-bit Python
running on a 64-bit OS.

Trent
have you tried platform.architecture()?
I just tried it:

WindowsXP in Parallels Desktop:
('32bit', 'WindowsPE')

Ubuntu 7.10 in Parallels Desktop:
('32bit', '')

Ubuntu 8.04 on a AMD64 Machine:
('64bit', '')

Mac 10.4 on a Intel64 Machine:
('32bit', '')

All look correct except for Mac.

Paul

Aug 2 '08 #1
0 1194

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Peter Hartmann | last post: by
28 posts views Thread by =?Utf-8?B?R2Vvcmdl?= | last post: by
2 posts views Thread by M O J O | last post: by
1 post views Thread by Morfys | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.