Hi!
I have folder with file master.py, which runs digit_span.py from subfolder digit_span.
When I use Spyder, everything works fine. But when I try to run master.py with system Python, I got the error “ModuleNotFoundError: No module named ‘psychopy’”. Curiosly if I call digit_span.py directly via console with system Python, it runs perfectly. I installed psychopy to my system Python, as well as to conda new environment. So I think that the problem hides somewhere in my master.py.
master.py:
if __name__ == "__main__":
import os
import subprocess
cDir = os.path.dirname(os.path.realpath(__file__)) + "/digit_span"
subprocess.call(["python", "digit_span.py"], cwd=cDir)
I need to call script via console because I won’t be able to install Anaconda to experimental laptop.
System: macOS Catalina v. 10.15.7
Spyder 3.3.6 Python 3.6.13 64-bit | Qt 5.12.9 | PyQt5 5.12.3 | Darwin 19.6.0
System Python 3.8
That’s definitely a little odd. I think it’s an issue with how subprocess works, where it’s calling the wrong version of Python somehow. Macs like to keep a version of Python 2.7 buried somewhere even if you’ve updated the system Python to 3.x. As a step 1, I would try the following:
Functionally this should be basically identical but as you can see from the documentation there are more options available to diagnose exactly what’s going on.
Thank you very very much, now it works from console!
But unfortunately now here comes another issue: both files (master.py as well as psychopy script digit_span.py) run, but immediately terminate with error “unexpected python termination”.
digit_span.py finishes with error “Illegal instruction: 4”. I suppose the error is the same for both scripts (because, let me remind you, master.py calls digit_span.py).
Recently, just few hours ago, experimental scripts ran very well! I attached a video that illustrates how everything goes wrong((
And the error (sorry, its on Russian, but I hope it would be clear)