I have two Python classes written in two different files. One is written in Python 2.7 and the other written in Python 3.2. One class is used inside the other.
Is it possible to run both of them so that one class will use the 3.2 interpreter and the other will use the 2.7 interpreter?
For instance in the terminal, can I just run the following command?
python3.2 firstClass.py
Any suggestions?
Thanks
I don’t believe it is possible for them to be running in the same process, that is you will have to choose one or the other. Python3 and Python2 bytecode are not compatible with each other, which you can confirm by attempting to run Python2 bytecode in Python3:
Try something more complicated to be sure. Compile
test.pyusing Python2 and then remove the.pyfile to make sure it isn’t recompiled by Python3. Then, attempt to import the.pycbytecode into a Python3 interpreter.