Howdy, Stranger!

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

Supported by

adding media_player_mpy to OpenSesame

Hi, i've been using the media player successfully in OpenSesame tasks. I've just updated to latest version, and now I don't have the media player (media_player_mpy) plugin. I'm using a Mac.

I've tried to follow the instructions for downloading the plugin again - but I'm not sure where to put things. I downloaded the folder from here: https://github.com/dschreij/opensesame-plugin-mediaplayer

For OSX it says to put the folder in the homefolder under ~/.opensesame/plugins/media_player_mpy

So I think I have this right:

Now I expected OpenSesame to have the plug in, and when I tried running a task to download ffmpeg. But there was no option to add media to my task (and opening an existing task that previously had movies created an error and the media module was removed from the block sequence).

Can anyone point me in the right direction here?

Comments

  • Update: i realised I was missing a 'plugins' folder in that directory. I added the media_player_mpy folder to the newly created plugins folder. And now I have the media player module! However...

    When I add the module to an experiment I get an error (pasted in full below) that seems to be a problem of the mediacoder.

    So I found where to download the mediacoder from githubg:

    But where do I put this (and which files/folders do i need)?


    Full error message I mentioned above:

    Traceback (most recent call last):
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 190, in new
        self.experiment.item_prefix()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/plugins.py", line 447, in load_plugin
        item_module = import_plugin(plugin, _type=_type)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/plugins.py", line 413, in import_plugin
        return imp.load_source(plugin, path)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/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 "/Users/robinlaycock/.opensesame/plugins/media_player_mpy/media_player_mpy.py", line 32, in <module>
        import mediadecoder
    ModuleNotFoundError: No module named 'mediadecoder'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libqtopensesame/widgets/tree_overview.py", line 821, in dropEvent
        self.drop_event_item_new(data, e)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libqtopensesame/widgets/tree_overview.py", line 720, in drop_event_item_new
        item, new_items = self.drop_get_item_snippet(data)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libqtopensesame/widgets/tree_overview.py", line 606, in drop_get_item_snippet
        catch_exceptions=False)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libqtopensesame/misc/qtitem_store.py", line 118, in new
        allow_rename=allow_rename
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 195, in new
        exception=e
    libopensesame.exceptions.osexception: 
    Failed to load plugin 'media_player_mpy'
    
    item-stack: 
    time: Sun Mar 13 15:42:19 2022
    exception type: ModuleNotFoundError
    exception message: No module named 'mediadecoder'
    
    Traceback:
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/item_store.py", line 190, in new
        self.experiment.item_prefix()
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/plugins.py", line 447, in load_plugin
        item_module = import_plugin(plugin, _type=_type)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/site-packages/libopensesame/plugins.py", line 413, in import_plugin
        return imp.load_source(plugin, path)
      File "/Applications/OpenSesame.app/Contents/Resources/lib/python3.7/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 "/Users/robinlaycock/.opensesame/plugins/media_player_mpy/media_player_mpy.py", line 32, in <module>
        import mediadecoder
    ModuleNotFoundError: No module named 'mediadecoder'
    


  • Hi,

    Try installing the missing package(s). In the case of mediadecoder, https://pypi.org/project/mediadecoder/

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • many thanks for the reply @eduard

    I'm afraid i'm a novice with python. I can't tell which of those to download (source distribution, or one of the two Built Distribution options?).

    I went a head and downloaded Built Distribution for py3. It appears I need to use python to install this?

    Although I found this guide for installing (https://packaging.python.org/en/latest/tutorials/installing-packages/), but I've found it fairly impenetrable. Hoping installing this is not too difficult. My previous version of OpenSesame did not require this.

  • Generally, you can use following procedure.

    1. Identify the missing package based on the error message (Usually the part "ModuleNotFoundError: No module named <MODULENAME>" gives it away
    2. Look online how this package is installed (that will give you a pip install like the one I linked above, in most cases)
    3. Install it directly in Opensesame, via the debug window (see here for guidance). If I am not mistaken, the syntax is simply !pip install MODULENAMEOptionally with a --user flag (in case you don't have root write permissions)

    I hope this helps!

    Eduard

    Buy Me A Coffee

  • ok great, point 3 helped a lot as I had no idea this step was needed. I was actually already working on step 2 but was stuck, but have worked it out. :)

Sign In or Register to comment.