QTI2TEXT
qti2txt converts quizzes exported from Canvas in QTI-format (version 1.2) into plaintext files. This is useful if you want ownership over your quizzes, if you are moving them to a different LMS, plan to use them for a paper exam, or edit them and reupload them using text2qti.
This project processes QTI (Question and Test Interoperability) quiz data. It strips namespaces from XML files, parses the data, and generates quiz questions in a .txt format that is mostly compatible with text2qti.
Installation
Install Python 3.13 or greater. You can download it from python.org.
qti2txt can be installed as follows:
pip install qti2txt
or
python3 -m pip install qti2txt
or using uv:
uv add qti2txt
Usage
To use qti2txt, you'll need a .zip file in QTI format. You can obtain one by exporting it from CANVAS as follows:
- Select your course in CANVAS.
- Click
Settings - Select
Export Course Content - Select
Quiz - Select the quizzes you want to export.
- Click
Create Export
Canvas will now export a .zip file containing the XML data (you may need to refresh your browser). Now that you have your .zip file.
In the terminal:
qti2txt -f YOUR_QTI_FILEPATH_HERE.zip
Other command-line options include:
-oor--output: specifies the output directory for the quiz files-kxmlor--keeptmpxml: keeps the temporary xml files created in the process of creating the quiz. The default is to try to delete these files.-vorverbose: verbose logging
Some basic recipes.
Quizzes and csv file are saved to a folder titled output:
qti2txt -f YOUR_QTI_FILE_HERE.zip -o output
Quizzes, a csv file, and temporary .xml files are saved to a folder titled output, verbose logging is on:
qti2txt -f YOUR_QTI_FILE_HERE.zip -o output -v -kxml
Features
-
Strips namespaces from XML files.
-
Generates quiz questions in a text format.
-
Extracts resources (e.g., imgs, gifs, etc.) from quizzes.
-
Replaces Wiris/Canvas data-mathml image tags (not raw mathml) with inline LaTeX.
-
Parses QTI quiz data for a limited number of question types:
- ✅ Multiple-Choice
- ✅ True/False (as a Multiple-Choice question)
- ✅ Fill-in-the-blank (processed as a short-answer question)
- ✅ Fill-in-multiple-blanks (note: not used in text2qti)
- ✅ Multi-Answer questions
- 🟡 Matching. Complete w/o distractors
- 🚧 Multiple dropdowns
- 🟡 Numerical Answer. Partial functionality: Exact Answer, Range, Exact Answer with margin of error.
- ❌ Formula question
- ✅ Essay
- ✅ File upload_question
- ✅ Text only question
- ✅ Incorporate LaTeX
- 🟡 Feedback on Question. Presently, there is only General feedback on the question. There is no question-specific feedback or feedback if Correct or feedback if Incorrect.
Requirements
- Python 3.x
defusedxmlfor XML parsing.html2textmathml-to-latex>=1.0.0
Resources
- Get Marked - API for converting docx, QTI, and Moodle XML quiz file into simplified JSON
- text2qti
Release files for qti2txt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qti2txt-0.1.0.tar.gz | 32.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qti2txt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 67.9 kB
Release files / qti2txt-0.1.0.tar.gz
| Download URL | qti2txt-0.1.0.tar.gz |
|---|---|
| Size | 32.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88e28d193c939eac57c7ccc32e16180d178126b483599c23d0403d4748f43cb5
|
|
BLAKE2b-256 checksum How to use checksums |
288d9c4df35c93692bebf98c2967929ee0cc1ad177cee99b5d292e009f0eaaf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / qti2txt-0.1.0-py3-none-any.whl
| Download URL | qti2txt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
349ca029bf458c650fa8cc9ffd0ccbde070d1c49709119695de58d3ee03a1dc6
|
|
BLAKE2b-256 checksum How to use checksums |
69e301fe5631c02b7e22c2a7bcfee57f6c9c60600abe650aaad9a52d17383357
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|