olxcleaner

raw JSON →
0.3.0 verified Fri May 01 auth: no python

Tool to scan Open edX courses in OLX format for various errors and inconsistencies. Current version 0.3.0, released Apr 2022. Maintenance mode.

pip install olxcleaner
error ModuleNotFoundError: No module named 'olxcleaner'
cause olxcleaner not installed.
fix
Run: pip install olxcleaner
error AttributeError: module 'olxcleaner' has no attribute 'CourseValidator'
cause Incorrect import path; CourseValidator is not at package level.
fix
Use: from olxcleaner.validator import CourseValidator
error FileNotFoundError: [Errno 2] No such file or directory: 'course.xml'
cause The input path does not contain a valid Open edX OLX course (missing course.xml).
fix
Provide the path to the root directory of the course OLX export, which should contain course.xml.
gotcha The package is designed for Open edX OLX exports, not for general XML. It expects the specific structure of an Open edX course tarball (course.xml, policies, etc.).
fix Ensure the input is a valid Open edX OLX course directory (e.g., extracted from a .tar.gz export).
gotcha The validate() function prints errors to stderr by default; it does not return a list. To get a list, use CourseValidator explicitly.
fix Use CourseValidator.validate() which returns a list of Error objects.
deprecated Python 3.6 is the minimum supported version; older Python versions will fail to install.
fix Upgrade to Python 3.6 or newer.

Validate an Open edX course OLX export for errors.

from olxcleaner import validate
from olxcleaner.validator import CourseValidator

# Run validation on a course export directory
errors = validate('/path/to/course/olx')
for error in errors:
    print(error)

# Or use the validator class for more control
validator = CourseValidator()
validator.load('/path/to/course/olx')
result = validator.validate()
print(result)