| Reference | Downloads | Github

Illegal Instruction: 4 when after kb = keyboard.Keyboard()

Hello there,
this problem has troubled me for some time so hopefully someone can’t help me see my blindspot.

My main goal was to record keypress duration. I found “psychopy.hardware.keyboard.Keyboard().getKeys(waitRelease=True)” may be something I need. However, after I add this line into my experiment, it somehow shut down automatically. One possibility may be the “Keyboard()” class part, as the following codes:

>>> from psychopy.hardware import keyboard
>>> kb = keyboard.Keyboard()
Illegal instruction: 4

I wonder what’s the problem behind “Illegal Instruction: 4.” What does it mean and what should I do?

Not sure if the version is related to this but just in case,
python version 3.7.3
psychopy version 2020.1.0
psychtoolbox psychtoolbox-3.0.16-py3.7-macosx-10.7-x86_64.egg
(stored in this directory miniconda3/lib/python3.7/site-packages)

Last, I’m sort of new to all this coding and scripting and I may not have enough background knowledge, but I’m willing to listen to all the comments I have. Thank you so much for your time.

This is going to be something to do with the conda environment. Is there a specific reason you can’t work with the standalone distribution of PsychoPy?

If you are new to coding, it avoids having to deal with all that mysterious background stuff, so you can focus on just mastering the code needed for your experiment.

Thank you Michael! Like you suggested, after I switched to the standalone distribution, the problem magically disappear! Now I can record the keypress duration as my wish. Really appreciate your help. This unknown bug taught me a lesson and as you said, without substantial background my main focus should be to master the code needed for my experiment.