Howdy, Stranger!

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

Supported by

[solved] media_player_gst error

edited July 2015 in OpenSesame

Hello,

I am running an experiment where I show several videos to participants. I run the experiment from opensesamerun.exe and a batch script. However, once the experiment ends, I get the following error: 'media_player_gst' object has no attribute 'gst_loop'. Anyone else run into this issue and have a fix for it?

Comments

  • edited June 2015

    No I haven't encountered this yet, but it sounds as if something goes wrong in the cleanup process. I will see if I can solve this next time I work on the plugin again. For now I have created an issue at https://github.com/dschreij/media_player_gst/issues/

    Buy Me A Coffee

  • edited 2:35PM

    I have the same problem running my experiment inside an OpenSesame instantiation using the "Run fullscreen" button. I use OpenSesame 2.9.6 with Python 2.7.6 on Linux Mint 17.1 with a 3.13.0-52-generic kernel.

    I do not program in Python but I have learned C, C++, Frotran, Pascal, Basic, R, many scripting languages such as bash and awk, and many assembly languages. I can therefore read some of the Python code.

    I cornered the problem to an experiment object imported from the experiment library in /usr/lib/pymodules/python2.7/libqtopensesame/misc/process.py:

    from libopensesame.experiment import experiment
    

    This file creates an experiment object called exp at line 125:

    exp = experiment(string=self.script, pool_folder= \
                    self.pool_folder, experiment_path=self.experiment_path, \
                    fullscreen=self.fullscreen, auto_response=self.auto_response, \
                    subject_nr=self.subject_nr, logfile=self.logfile)
    

    which is then used line 139:

    exp.run()
    

    run() is defined in /usr/lib/pymodules/python2.7/libopensesame/experiment.py line 331. The function definition ends with self.end() defined line 366 in the same file. The last but one instruction of end() is self.cleanup() defined line 357.

        def cleanup(self):
    
            """Calls all the cleanup functions."""
    
            while len(self.cleanup_functions) > 0:
                func = self.cleanup_functions.pop()
                debug.msg(u"calling cleanup function")
                func()
    

    As far as I can understand, there is a list or a tuple or any kind of container cleanup_functions defined in the experiment object that contains the names of functions to be called to cleanup the resources used by the plugin. The faulty function called in the while loop is close_streams defined in media_player_gst.py line 896:

        def close_streams(self):
            """
            A cleanup function, to make sure that the video files are closed and 
            any resources taken up by GStreamer are freed
    
            Returns:
            True on success
            """
            if self.gst_loop.is_running():  
                # Free resources claimed by gstreamer
                self.player.set_state(gst.STATE_NULL)
                # Quit the player's main event loop
                self.gst_loop.quit()
    
    
            return True
    

    The plugins complains about the line if self.gst_loop.is_running(): because:

    AttributeError: 'media_player_gst' object has no attribute 'gst_loop'

    So it seems that a media_player_gst object defined line 536 can be created without the attribute gst_loop. This attribute seems to be created line 604 by the object function prepare(self) defined line 591. I do not know when a media_player_gst object can be created without the gst_loop attribute. I do not know well enough Python and OpenSesame to investigate that issue. I hope that it will not be too difficult for you when you have time to work on the plugin.

    Excuse-me if I did not use the Python vocabulary when I described the concepts. I am used to C++ environment. I just started to learn Python a couple weeks ago just because I decided to use OpenSesame four weeks ago. I only invest one hour from time to time learning Python because I need to work on my projects.

    If I can be of any help despite my low level in OpenSesame and Python, do not hesitate to contact me.

    Best regards and good luck on this issue.

  • edited 2:35PM

    Thanks for diving into this. It think it is safe to say the the cleanup function is no longer necessary if gst_loop is no longer present. This basically means the clean_up function has already been invoked elsewhere before. See my comment on Github for a workaround for this issue: https://github.com/dschreij/media_player_gst/issues/3#issuecomment-114558607. Could you tell me if this worked for your error (It is hard for me to reproduce it). If so, I will commit this change to the main repository.

    Buy Me A Coffee

  • edited 2:35PM

    Thanks to both of you for investigating the issue! I tweaked the code in the media_player_gst.py file as per dshreij's suggestion on github (https://github.com/dschreij/media_player_gst/issues/3#issuecomment-114558607). I did a few runs on the experiment that was giving me the warning, and it appears to have fixed the issue. Hopefully it works for other users!

  • edited 2:35PM

    As I wrote in the github thread with more details, it worked well :-)

    @dschreij: As I wrote in the email sent to you, I wonder where the clean up is done. When I have learned more Python features including class definition with constructor and destructor, I will track down the clean up process to know what is really happening. I will keep you acquainted if I succeed.

    Thanks a lot for the solution, it was a very little bug without real effect on the experiment but nevertheless unpleasant.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games