Types for olefile

raw JSON →
0.47.0.20260408 verified Mon Apr 27 auth: no python

Typing stubs for olefile (v0.47.0.20260408), provided by typeshed. These stubs enable static type checking for the olefile package. The package follows typeshed's release cadence, typically updated to match CPython's typing stubs.

pip install types-olefile
error ModuleNotFoundError: No module named 'olefile'
cause Missing olefile runtime package.
fix
pip install olefile
error Cannot find reference 'OleFileIO' in 'types_olefile'
cause Importing from types_olefile instead of olefile.
fix
Use 'from olefile import OleFileIO'
gotcha You must install both olefile and types-olefile. types-olefile alone does not provide runtime functionality.
fix Install both: pip install olefile types-olefile
gotcha The stubs only cover olefile's public API. Internal functions or undocumented methods may not be typed.
fix Use only documented public API to benefit from type hints.
deprecated Some older olefile methods like `getproperties` are deprecated and not fully typed in stubs.
fix Use OleFileIO.get_metadata() instead.

Open an OLE2 file, check for stream existence, and read metadata.

from olefile import OleFileIO

with OleFileIO('example.ole') as ole:
    if ole.exists('\x05SummaryInformation'):
        meta = ole.get_metadata()
        print(meta.author, meta.title)