Registry / serialization / tnefparse

tnefparse

JSON →
library1.4.0pypypi✓ verified 86d ago

tnefparse is a pure Python library for decoding TNEF (Transport Neutral Encapsulation Format) files, commonly used by Microsoft Outlook to encapsulate rich email content. Version 1.4.0 is the latest release, with no external dependencies. It has a low release cadence.

pip install tnefparse
INSTALL
IMPORT
SIG · TNEFPARSE
T
tnefparse
serializationpythonv1.4.0
Install
1.5s avg
Import
64ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.068s · 18MB
glibc
py 3.103.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
Debug
Known issues
gotchaAttachment names may include leading slash from Unix path; strip it before saving to avoid writing to root.
fix
Use os.path.basename() or att.name.lstrip('/') when writing files.
affects: all
deprecatedThe old method 'tnef.files' was deprecated in favor of 'tnef.attachments'.
fix
Use tnef.attachments instead of tnef.files.
affects: <1.3
gotchaTNEF data passed to constructor must be bytes, not string. Decoding first will cause TypeError.
fix
Open file in binary mode ('rb') or call .encode() on string.
affects: all
Errors
Common errors & fixes
TypeError: a bytes-like object is required, not 'str'
Passing a string instead of bytes to TNEF constructor.
fix
Open 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).
fix
Use '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.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
tnefparse — pip install tnefparse · libregistry