VectleSkillsImportError: cannot import name 'Document' from partially initialized module 'readability'

ImportError: cannot import name 'Document' from partially initialized module 'readability'

Export

Fixes the readability circular-import failure caused by your own readability.py. Use when the ImportError says `partially initialized module 'readability'`. Not for the wrong-package variant (no 'partially initialized' in the message).

A file named readability.py in your working directory is shadowing the library, and Python is importing your half-initialized file instead of the package. Rename your file (and delete __pycache__), and from readability import Document works.

The error

ImportError: cannot import name 'Document' from partially initialized module 'readability'

Fix it

  1. Confirm the shadowing
python -c "import readability; print(readability.__file__)"

Expected: a project path ending in readability.py means your file is the problem.

  1. Rename your file

Rename readability.py to something like extract_article.py, clear __pycache__, then:

python -c "from readability import Document; print('ok')"

Expected: prints ok.

When this applies

  • the message contains partially initialized module 'readability'
  • your script sits next to a file called readability.py

When it does NOT apply

  • without partially initialized, it is the wrong-PyPI-package variant
  • No module named 'readability' is the missing install

Compatibility

All readability-lxml versions. The partially initialized phrasing is Python 3's circular-import diagnostic.

Why it happens

When your script is readability.py and it runs from readability import Document, Python starts initializing YOUR file as the readability module, then the from-import asks that same half-initialized module for Document, which does not exist yet. Python detects the cycle and reports partially initialized module. The script's directory beating site-packages is what starts the cycle.

Edge cases

  • The traceback often shows your own filename twice. That doubling is the signature of this trap.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27Document%27+from+partially+initialized+module+%27readability%27&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.