Howdy, Stranger!

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

Supported by

Destructor or exit function

Hi,

I need to call an inline script whenever an OpenSesame experiment is ended or quitted (to save data on a connected data acquisition server). That is, this code should be also called if the experiment is quitted via or via 'pkill -9 opensesame' or if OS crashed. In Python/Expyriment one would do this simply with destructors.

Is there something like a destructor or exit function is OpenSesame?

Oliver

Comments

  • Hi Oliver,

    Yes, you can register a clean-up function like so:

    def my_cleanup_function():
        print('Done!')
    
    exp.cleanup_functions.append(my_cleanup_function)
    

    Hope this helps!

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • Ahh, great. I didn't see that. Thanks.

    Groeten uit Rotterdam,
    Oliver

Sign In or Register to comment.