Hello. Could you help me to solve my problem? Thanks a lot.
I guess my problem is due to python versions conflict. The detail is as follows.
Environment
- MacBook Air
- OS:macOS Sierra 10.12.6
I already have the python 2.7.10 in my mac. It is the default version if I use the command line “python” to call python.
I also have python3.4 in my mac. It can be called by the command --“python3”.
When I use Psychopy, even I run a simple experiment (like display “text” for 1s), it goes wrong. The error message is:
######## Running: /Users/Duo/Desktop/new_task_WH_CE/untitled_lastrun.py ########
Traceback (most recent call last):
File “soundfile.pyc”, line 142, in
OSError: sndfile library not found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/Users/Duo/Desktop/new_task_WH_CE/untitled_lastrun.py”, line 14, in
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/init.py”, line 79, in
from . import backend_sounddevice as backend
File “/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6/psychopy/sound/backend_sounddevice.py”, line 20, in
import soundfile as sf
File “”, line 961, in _find_and_load
File “”, line 950, in _find_and_load_unlocked
File “”, line 646, in _load_unlocked
File “”, line 616, in _load_backward_compatible
File “soundfile.pyc”, line 156, in
File “posixpath.pyc”, line 78, in join
TypeError: expected str, bytes or os.PathLike object, not list
I went to check the files mentioned in the error messages. Then I found these code files declared “#!/usr/bin/env python” first. I guess it direct the python to the wrong version. In my case, it directs the python to the python2.7.
If I redirect the python from python2.7 to python3.6 built in the psychopy, I think the psychopy will work normally.
I tried to add the path of the python3.6 which is included in the psychopy as follow, but it didn’t work.
/Applications/PsychoPy3.app/Contents/Resources/lib/python3.6
Could you help me to solve the problem? Thanks a lot.