Skip to main content

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:

  1. Select your course in CANVAS.
  2. Click Settings
  3. Select Export Course Content
  4. Select Quiz
  5. Select the quizzes you want to export.
  6. 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:

  • -o or --output: specifies the output directory for the quiz files
  • -kxml or --keeptmpxml: keeps the temporary xml files created in the process of creating the quiz. The default is to try to delete these files.
  • -v or verbose: 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
  • defusedxml for XML parsing.
  • html2text
  • mathml-to-latex>=1.0.0

Resources

  1. Get Marked - API for converting docx, QTI, and Moodle XML quiz file into simplified JSON
  2. 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)

Source distribution for qti2txt 0.1.0
File Size Uploaded
qti2txt-0.1.0.tar.gz 32.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qti2txt 0.1.0
File Interpreter ABI Platform
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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page