Registry / serialization / docx-mailmerge

docx-mailmerge

JSON →
library0.5.0pypypi✓ verified 86d ago

Performs a Mail Merge on docx (Microsoft Office Word) files using Python. Current version: 0.5.0. Low release cadence (last release in 2018).

pip install docx-mailmerge
INSTALL
IMPORT
SIG · DOCX-MAILMERGE
D
docx-mailmerge
serializationpythonv0.5.0
Install
2.1s avg
Import
64ms
Disk
28MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.068s · 29.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.060s · 30MB
28MB installed
● package 28MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MailMerge
from mailmerge import MailMerge
from docx_mailmerge import MailMerge
Package install name is 'docx-mailmerge', but import uses 'mailmerge'.

Open a DOCX template, merge fields, and save output.

from mailmerge import MailMerge doc = MailMerge('input.docx') doc.merge(field1='value1', field2='value2') doc.write('output.docx')
Debug
Known issues
breakingPython 2 support was dropped in 0.4.0. Version 0.5.0 requires Python 3.5+.
fix
Use Python 3.5 or higher.
affects: 0.4.0 - 0.5.0
gotchaMerge field names must match exactly (case-sensitive). Common mistake: using spaces instead of underscores.
fix
Verify field names in the template by inspecting XML or using MailMerge.get_merge_fields().
affects: all
gotchaThe merge() method overwrites the internal document; subsequent merge calls will lose previous merges unless you re-open the template.
fix
Use a context manager or re-initialize MailMerge for each merge iteration.
affects: all
Errors
Common errors & fixes
ImportError: No module named 'mailmerge'
Incorrect package name used in import; package is 'mailmerge' not 'docx_mailmerge'.
fix
Run: from mailmerge import MailMerge
KeyError: 'field_name'
The merge field name provided does not exist in the template or is not extracted correctly.
fix
List fields with: doc.get_merge_fields() and use exact names.
Upgrade
Version history
0.5.0latest on PyPI · released Oct 9, 2019
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
docx-mailmerge — pip install docx-mailmerge · libregistry