Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Experiences with OS4 (plugin adventures)

edited May 2023 in OpenSesame

Hi Sebastiaan:

My experieces with using "my" plugins on OS4: My plugins are a set of plugins I wrote mainly to connect OS to hardware we use for synchronising OS with EEG recording systems and Buttonboxes at the University of Groningen.

OpenSesame 4.0.0a33 Melodramatic Milgram

the installation goes well:

!pip install evtplugins
Collecting evtplugins
 Using cached EvtPlugins-0.99.34-py3-none-any.whl (51 kB)
Requirement already satisfied: pyEVT in c:\program files (x86)\opensesame4\lib\site-packages (from evtplugins) (0.99.32)
Requirement already satisfied: hidapi in c:\program files (x86)\opensesame4\lib\site-packages (from pyEVT->evtplugins) (0.13.1)
Requirement already satisfied: setuptools>=19.0 in c:\program files (x86)\opensesame4\lib\site-packages (from hidapi->pyEVT->evtplugins) (67.7.2)
Installing collected packages: evtplugins
Successfully installed evtplugins-0.99.34


using the EVTxx plugin give the following trace and fails:


Traceback (most recent call last):
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 736, in dropEvent
  self.drop_event_item_new(data, e)
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 638, in drop_event_item_new
  item, new_items = self.drop_get_item_snippet(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 525, in drop_get_item_snippet
  item = self.experiment.items.new(item_dict[u'item-type'],
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtitem_store.py", line 105, in new
  item = super(qtitem_store, self).new(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\item_store.py", line 158, in new
  item = self.experiment.plugin_manager[_type].build(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtplugin_manager.py", line 98, in build
  return plugins.load_plugin(self.name, *args, prefix='qt', **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\plugins.py", line 420, in load_plugin
  item = item_class(item_name, experiment, string)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\share\opensesame_plugins\EVTxx\EVTxx.py", line 78, in __init__
  qtautoplugin.__init__(self, __file__)
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\items\qtplugin.py", line 68, in __init__
  self.init_item_icon()
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\items\qtplugin.py", line 77, in init_item_icon
  icon = self.plugin_manager[self.item_type].icon
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\plugin_manager.py", line 216, in __getitem__
  return self._plugins[name]
      ~~~~~~~~~~~~~^^^^^^
KeyError: 'e_v_txx'


The Responsebox pluging yeilds the same (?) error:


Traceback (most recent call last):
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 736, in dropEvent
  self.drop_event_item_new(data, e)
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 638, in drop_event_item_new
  item, new_items = self.drop_get_item_snippet(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 525, in drop_get_item_snippet
  item = self.experiment.items.new(item_dict[u'item-type'],
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtitem_store.py", line 105, in new
  item = super(qtitem_store, self).new(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\item_store.py", line 158, in new
  item = self.experiment.plugin_manager[_type].build(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtplugin_manager.py", line 98, in build
  return plugins.load_plugin(self.name, *args, prefix='qt', **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\plugins.py", line 420, in load_plugin
  item = item_class(item_name, experiment, string)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\share\opensesame_plugins\ResponseBox\ResponseBox.py", line 110, in __init__
  qtautoplugin.__init__(self, __file__)
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\items\qtplugin.py", line 68, in __init__
  self.init_item_icon()
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\items\qtplugin.py", line 77, in init_item_icon
  icon = self.plugin_manager[self.item_type].icon
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\plugin_manager.py", line 216, in __getitem__
  return self._plugins[name]
      ~~~~~~~~~~~~~^^^^^^
KeyError: 'response_box'


When I rename the EVTxx plugin to evtxx (directory and filenames....) I get another errormessage:


Traceback (most recent call last):
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 736, in dropEvent
  self.drop_event_item_new(data, e)
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 638, in drop_event_item_new
  item, new_items = self.drop_get_item_snippet(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\widgets\tree_overview.py", line 525, in drop_get_item_snippet
  item = self.experiment.items.new(item_dict[u'item-type'],
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtitem_store.py", line 105, in new
  item = super(qtitem_store, self).new(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\item_store.py", line 158, in new
  item = self.experiment.plugin_manager[_type].build(
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libqtopensesame\misc\qtplugin_manager.py", line 98, in build
  return plugins.load_plugin(self.name, *args, prefix='qt', **kwargs)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\Program Files (x86)\OpenSesame4\Lib\site-packages\libopensesame\plugins.py", line 419, in load_plugin
  item_class = getattr(item_module, prefix + plugin)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'evtxx' has no attribute 'qtevtxx'


because this module has a class qtEvtxx(Evtxx, qtautoplugin) i rename that to qtevtxx and now I can drag the plugin 

to the tree and I get the interface.


When I run a simple test, opensesame crashes hard with a message:


AttributeError: module 'evtxx' has no attribute 'evtxx'


leading me to rename the object (the plugin class) to evtxx...


And now it all works.....


So my "problems" are caused by capitalisation of filenames and


I assume at this moment this is probably an artifact of my hacking way of programming, but maybe this could help others to get the transision to OS4 as smooth as possible.

Can you give me some pointers on how to make my plugins follow the style guidelines better?

Comments

  • Hi @MarkS ,

    Thanks for reporting this. Indeed, it's because of the changed naming conventions in the new 4.0 plugin API. (Which now follows the PEP8 naming conventions.) However, it's still a bug because backwards compatibility with older plugins should have been preserved. I pushed a fix for this in 4.0.0a40. If you update, which you can do through the built-in updater, then the plugins should work again. If not, let me know.

    — Sebastiaan

  • Works as a charm now. Thank you Sebastiaan.

Sign In or Register to comment.