Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

7.1Prepare and encode the question file (Manual preparation) - 🧑‍🏫 🏫

The question file is a text file, so it can be prepared and maintained using a simple text editor, following the structure detailed in Section 4.1. Once this file has been prepared, you may want to generate

prepare_files(input_file, output_file, mode="crypt", pwd=‘’):    
    """
    
Prepare YAML files for quizzes. 
    Outputs two files, with the basename given in `output_file`.
 
    The second file is questions only and is the input stripped
    from responses and tips. With the `mode="crypt"`, the input and stripped
     
versions are encrypted; with `mode="enc"`, both files are base64 encoded; 
    finally, with `mode=yml`, files are not encoded nor encrypted.
Parameters
    
----------
input_file : str
Path to the input YAML file.
output_file : str
Path to the output YAML file.
mode : str, optional
Mode to prepare the file. Choose from "crypt", ‘enc’, or "yml".
pwd : str, optional
Password for file encryption.

It can be used, for example, as follows

from labquiz.putils import prepare_files
prepare_files("quizzes_basic_filtering_test.yaml", "qbf.yml", mode="crypt", pwd=PASSWORD)

which produces

- Creating qbf_crypt.txt
- Creating qbf_qo_crypt.txt
⚠️ File encrypted with pwd. Ensure to use the `mandatoryInternet=True` option in quiz init

➡️ You will copy the password, if any, into cell A2 of the Config sheet of the Google Sheet, see Section 10.1, if you are using a GS to collect the results.