Install & Compatibility
Where this runs
tested against v1.4.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.068s · 18MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.060s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
TNEF
✓ from tnefparse import TNEF
✗ import tnefparse.TNEF
TNEF is the main class, not a module.
TNEFAttachment
✓ from tnefparse import TNEFAttachment
Attachment class for accessing file data.
Open a TNEF file (often winmail.dat) and list attachments.
import os
from tnefparse import TNEF
with open('winmail.dat', 'rb') as f:
data = f.read()
tnef = TNEF(data)
print('Attachments:', len(tnef.attachments))
for att in tnef.attachments:
print('Name:', att.name)
if att.name:
with open(att.name.lstrip('/'), 'wb') as out:
out.write(att.data)
tnefparse --version
Errors
Common errors & fixes
TypeError: a bytes-like object is required, not 'str'
Passing a string instead of bytes to TNEF constructor.
fixOpen the file in binary mode: with open('winmail.dat', 'rb') as f: data = f.read() AttributeError: 'TNEF' object has no attribute 'files'
Using deprecated 'files' attribute in newer versions (>=1.3).
fixUse 'tnef.attachments' instead of 'tnef.files'.
Upgrade
Version history
1.4.0latest on PyPI · released Jan 24, 2021
Audit
Dependencies
No dependency data recorded yet.