[Ironpython-users] How can I detect whether I am running a 64.bit version of Windows?
jdhardy at gmail.com
Sat Feb 18 22:35:58 CET 2012
is the function you want, and you should be able to use ctypes to call
it from CPython and IronPython.
On Sat, Feb 18, 2012 at 8:42 AM, Vernon Cole <vernondcole at gmail.com> wrote:
> Thanks for your help, everyone.
> The following appears to do what I asked for:
> """is64bit() returns boolean value of detected Python word size"""
> def is64bit():
> import sys
> if sys.platform == 'cli': # IronPython
> import System
> return System.IntPtr.Size == 8
> else: # CPython
> return sys.maxsize > 2147483647
> except AttributeError:
> return False # assume old versions of Python are 32 bit.
> if __name__ == "__main__":
> print ("is64bit =", is64bit())
> Unfortunately <smacking head with hand and muttering "doh!"> I did not ask
> for what I actaully _needed_ :
> The correct question should have been:
> How do I detect whether I am running on a 64 bit version of Windows (even
> though I might be using 32 bit Python)?
> On Mon, Feb 13, 2012 at 3:32 PM, Dino Viehland <dinov at microsoft.com> wrote:
>> You can either check System.IntPtr.Size and see if it’s 4 or 8 (which is
>> what I’ve usually done in the past and works on all versions of .NET) or you
>> can check System.Environment.Is64BitProcess (this will read a little better,
>> but is new in .NET 4).
>> From: ironpython-users-bounces+dinov=microsoft.com at python.org
>> [mailto:ironpython-users-bounces+dinov=microsoft.com at python.org] On Behalf
>> Of Vernon Cole
>> Sent: Monday, February 13, 2012 1:38 PM
>> To: ironpython-users at python.org
>> Subject: [Ironpython-users] How can I detect whether I am running ipy.exe
>> or ipy64.exe?
>> I am testing adodbapi with IPy 2.7.2a2 -- using my new laptop which I have
>> set up as an everything in 64-bit test bed.
>> My default test database is an .mdb (so-called ACCESS database) file.
>> Microsoft has decided that the JET engine, which has historically been used
>> to read and write that format is to be deprecated, so there is no 64 bit
>> version of it. It is replaced by the Access Database Engine 2010
>> redistributable. Of course, the new software requires a different connection
>> string, one containing "Provider=Microsoft.ACE.OLEDB.12.0;".
>> So, how can I tell which width of IronPython I am running, so I know which
>> connection string to use?
> Ironpython-users mailing list
> Ironpython-users at python.org
More information about the Ironpython-users