473,396 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

determine 32 or 64 bit architecture with python 2.2

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

Jun 19 '07 #1
6 4887
On Jun 19, 9:17 pm, Kai Rosenthal <kairosent...@tiscali.dewrote:
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?

Jun 19 '07 #2
On Jun 19, 4:28 pm, John Machin <sjmac...@lexicon.netwrote:
On Jun 19, 9:17 pm, Kai Rosenthal <kairosent...@tiscali.dewrote:
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.

Jun 19 '07 #3
David Rushby wrote:
On Jun 19, 4:28 pm, John Machin <sjmac...@lexicon.netwrote:
>On Jun 19, 9:17 pm, Kai Rosenthal <kairosent...@tiscali.dewrote:
>>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
<le***@telus.net>
Jun 19 '07 #4
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
Jun 20 '07 #5
>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
Jun 20 '07 #6
On 6/19/07, Kai Rosenthal <ka**********@tiscali.dewrote:
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@thinkpad ~ $ python -c 'import os; print os.uname()[4]'
i686

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

--
Evan Klitzke <ev**@yelp.com>
Jun 20 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: ketulp_baroda | last post by:
Hi Does python support MVC architecture? Java has register & notify obsever methods in javax.util . Does python has these functions. If not then how to register the views with the models & how to...
9
by: Lenard Lindstrom | last post by:
I was wondering if anyone has suggested having Python determine a method's kind from its first parameter. 'self' is a de facto reserved word; 'cls' is a good indicator of a class method ( __new__...
0
by: Fritz Bosch | last post by:
We are in the process of refactoring our GUI-based test application for radio equipment and are rewriting a significant part in Python. The new architecture will substantially be based on the...
15
by: limeydrink | last post by:
Hi all, I want to create a mobile field worker data solution. Let me explain... I work for a company that has some software used by call takers to enter information into a database about...
1
by: tommak | last post by:
It's a dream of human beings to build machines that can think and behave like human beings. The most important part of of such a machine is an artificial mind that can emulate the cognitive...
7
by: Samuel | last post by:
Hi, I am looking for some recommendations for client/server technologies and for the communication involved. I am currently planning to port a Perl application that has grown out of...
1
varuns
by: varuns | last post by:
hi where i can find the architecture of python as i want to know the internal implementation of python bye
4
by: Arnaud Delobelle | last post by:
Hi fellow python enthusiasts. Having recently acquired a MacBook Pro (Intel Core 2 Duo) which comes with python2.5, I have been installing some modules that I need (PIL, psycopg2, PyXML ...). ...
6
by: BA | last post by:
Hi Everyone, I have an application that sits behind a server farm, the application needs to pass its NLB IP address in the message that it sends to another service. From C# code, how can I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.