I have 2 seperate python.exe, one is 64bit one is 32bit. The 64bit is the default one. How can I use subprocess
or sys
(or any relevant package) to switch control during mid-execution from the 64 bit to the 32 bit, execute code only for the 32 bit, then switch control back to the 64bit version? In other words, I'm looking for something like...
if struct.calcsize("P")==8: # check if 64 bit version
# switch to 32 bit version
# ??? new_shell = subprocess.Popen(location of 32 bit python.exe)??? what would go here
# pass a bunch of commands and then switch control back
# to the 64 bit version
Also, I'm using anaconda, so I imagine the first call will be for switching to the 32bit python.exe environment? During the 32bit process, some packages need to be imported and data will be returned at the end.
Mid-execution between both 32-bit and 64-bit modes mostly likely is not possible. To resolve, consider compartmentalizing your workflow into several scripts and have both 32-bit and 64-bit versions of script when needed:
Additionally, because both bit versions of Python cannot "talk" to each other, you will need to run dual, separate scripts that are conditionally called depending on OS type (32-bit vs. 64-bit). And arguments can be passed with subprocess:
Environment path variables or default command line paths will not be useful as it reverts to one python version and not explicitly the other. Hence, the need for absolute declaration of python.exe version.