Detect weather unter x86 or x64 Windows
There are many ways to detect weather your application runs in a 32 bit environment or a 64 bit environment. This is the simplest way I could find (it also detects wine):
import ctypes, os, platform
def GetBits()
"""
returns "32bit", "64bit", "wow64" or "wine"
"""
try:
ctypes.windll.kernel32.wine_get_unix_file_name()
return "wine"
except AttributeError:
arch = platform.architecture()[0]
return "wow64" if arch=="32bit" and ("PROGRAMFILES(X86)" in os.environ) else arch
Written by Malte Bublitz
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#