Howdy, Stranger!

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

Supported by

[open] Questionnaire Functionality

edited September 2012 in OpenSesame

Hi Sebastiaan,

Is it possible to import text into a variable from a text file in the file pool using the open_question plugin? I have succeeded with the text_display plugin but it does not seem to be working in a questionnaire.

Thanks

Anthony

Comments

  • edited 12:31PM

    Hi Anthony,

    Sure! First, you need to set the question field of the open_question item to [_question]. There are a few odd things here:

    • You cannot combine variables with text, like my question is: [_question]. The field has to contain either only a variable, or only text.
    • The variable cannot be named question, because open_question already uses a variable of that name (you will get recursion errors if you try this).

    To read the question from a text file, you can use a script like this (see the code comments):
    [gist:3743592]

    This script is clearly the most simple case, in which there is a single text file in the file pool, which contains a single question. For more sophisticated text handling, you could take a look at functions such as numpy.loadtxt().

    Good luck!

    Cheers,
    Sebastiaan

Sign In or Register to comment.