[Ironpython-users] How can I detect whether I am running a 64.bit version of Windows?
vernondcole at gmail.com
Sat Feb 18 17:42:52 CET 2012
Thanks for your help, everyone.
The following appears to do what I asked for:
"""is64bit() returns boolean value of detected Python word size"""
if sys.platform == 'cli': # IronPython
return System.IntPtr.Size == 8
else: # CPython
return sys.maxsize > 2147483647
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
> *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.<http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=13255>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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users