import error with Sound_Start_Recording item
Hello,
I was trying to enable recording for my experiment but got this error when I tried to drag the Sound_Start_Recording item to the experiment. Could anyone please help me see what the problem is and how to solve it?
Thank you very much for your time and help.
Kind regards,
Alice
"Error message:
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 190, in new
self.experiment.item_prefix()
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\plugins.py", line 447, in load_plugin
item_module = import_plugin(plugin, _type=_type)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\plugins.py", line 413, in import_plugin
return imp.load_source(plugin, path)
File "C:\Program Files (x86)\OpenSesame\lib\imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\sound_start_recording\sound_start_recording.py", line 20, in <module>
from libqtopensesame import qtplugin
ImportError: cannot import name 'qtplugin' from 'libqtopensesame' (C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 788, in dropEvent
self.drop_event_item_new(data, e)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 702, in drop_event_item_new
item, new_items = self.drop_get_item_snippet(data)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 588, in drop_get_item_snippet
catch_exceptions=False)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\misc\qtitem_store.py", line 118, in new
allow_rename=allow_rename
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 195, in new
exception=e
libopensesame.exceptions.osexception:
Failed to load plugin 'sound_start_recording'
item-stack:
time: Wed Apr 8 20:47:31 2020
exception type: ImportError
exception message: cannot import name 'qtplugin' from 'libqtopensesame' (C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\__init__.py)
Traceback:
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\item_store.py", line 190, in new
self.experiment.item_prefix()
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\plugins.py", line 447, in load_plugin
item_module = import_plugin(plugin, _type=_type)
File "C:\Program Files (x86)\OpenSesame\Lib\site-packages\libopensesame\plugins.py", line 413, in import_plugin
return imp.load_source(plugin, path)
File "C:\Program Files (x86)\OpenSesame\lib\imp.py", line 171, in load_source
module = _load(spec)
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\sound_start_recording\sound_start_recording.py", line 20, in <module>
from libqtopensesame import qtplugin
ImportError: cannot import name 'qtplugin' from 'libqtopensesame' (C:\Program Files (x86)\OpenSesame\Lib\site-packages\libqtopensesame\__init__.py) "
Comments
Hi Alice,
The sound recorder plugins are very old, they were written for outdated versions of Opensesame. I don't know whether they generally work with the current version or not. In other words, I don't know whether your problem is a general one, or something that is specific to you.
From the error message it seems that the module "qtplugin" is not found in the program folders. So, some pyqt-related issue could be the issue. However, I doubt that there is an easy fix to that problem. You are probably better off implementing sound recording yourself. Check out this page for example: https://realpython.com/playing-and-recording-sound-python/
It essentially requires you to do some Python coding in an inline_script. Not terribly complicated but if you do it for the first time it might be a little challenging.
Does that make sense?
Eduard
Hi @Fang,
as Eduard correctly states, the sound recorder plugins are heavily outdated and probably no longer function correctly. If you are familiar with scripting, and use the psychopy backend, you can try and see if you can use their modules to achieve your goals, see https://www.psychopy.org/api/voicekey.html and https://www.psychopy.org/api/microphone.html