Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

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

  • sebastiaansebastiaan Posts: 2,813

    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

  • oliveroliver Posts: 10

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

    Groeten uit Rotterdam,
    Oliver

Sign In or Register to comment.