I need a way to tell what mode the shell is in from within the shell.
I've tried looking at the platform module but it seems only to tell you about "about the bit architecture and the linkage format used for the executable": the binary is compiled as 64bit though (I'm running on OS X 10.6) so it seems to always report 64bit even though I'm using the methods described here to force 32bit mode).
after hitting python in cmd
UPDATED: One way is to look at
sys.maxsize
as documented here:sys.maxsize
was introduced in Python 2.6. If you need a test for older systems, this slightly more complicated test should work on all Python 2 and 3 releases:BTW, you might be tempted to use
platform.architecture()
for this. Unfortunately, its results are not always reliable, particularly in the case of OS X universal binaries.Try using ctypes to get the size of a void pointer:
It'll be 4 for 32 bit or 8 for 64 bit.
Open python console:
it should display the '64bit' or '32bit' according to your platform.
Alternatively( in case of OS X binaries ):
platform.architecture()
notes say:Platform Architecture is not the reliable way. Instead us: