473,224 Members | 1,702 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,224 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 4884
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...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.