Skip to content

pyaccesskit.diagnostics

pyaccesskit.diagnostics

Environment diagnostics: which engines PyAccessKit can use on this machine, and why not.

pyaccesskit doctor prints this report; :func:diagnose returns it as data (:meth:Diagnosis.to_dict gives a JSON-ready form). Without probe=True nothing is started: the report comes from the registry, file headers and loading DAO in-process. With probe=True a scratch database is built with each usable engine, in an Access process owned (and closed) by PyAccessKit.

EngineCheck dataclass

EngineCheck(
    engine: EngineName, available: bool, detail: str
)

Whether one engine can be used from this Python, with an explanation.

AccessInstallation dataclass

AccessInstallation(
    progid: str,
    registered_version: str | None,
    executable: str | None,
    version: str | None,
    bits: int | None,
    click_to_run: bool,
    products: tuple[str, ...] = (),
)

Microsoft Access as registered for automation.

OwnedProcessReport dataclass

OwnedProcessReport(
    pid: int,
    owner_pid: int,
    database: str | None,
    status: str,
)

An Access process recorded in the ownership ledger, and what cleanup would do with it.

ProbeReport dataclass

ProbeReport(
    engine: EngineName,
    ok: bool,
    seconds: float,
    detail: str,
)

The outcome of building a scratch database with one engine.

Diagnosis dataclass

Diagnosis(
    pyaccesskit_version: str,
    python_version: str,
    python_bits: int,
    python_executable: str,
    operating_system: str,
    pywin32_version: str | None,
    access: AccessInstallation | None,
    engines: tuple[EngineCheck, ...],
    ace_oledb: tuple[str, ...],
    auto_engine: EngineName | None,
    owned_processes: tuple[OwnedProcessReport, ...],
    probes: tuple[ProbeReport, ...],
    problems: tuple[str, ...],
    notes: tuple[str, ...],
)

Everything pyaccesskit doctor reports.

Attributes:

Name Type Description
auto_engine EngineName | None

What engine="auto" selects here (None: nothing is usable).

engines tuple[EngineCheck, ...]

Availability of in-process DAO and of Microsoft Access.

ace_oledb tuple[str, ...]

ACE OLEDB providers loadable in-process (used for Decimal columns with in-process DAO).

owned_processes tuple[OwnedProcessReport, ...]

Ledger entries of Access processes started by PyAccessKit.

probes tuple[ProbeReport, ...]

Results of probe=True runs.

problems tuple[str, ...]

Reasons PyAccessKit cannot work (or cannot work fully).

notes tuple[str, ...]

Useful facts and advice that are not problems.

usable property

usable: bool

At least one engine is available and every probe that ran succeeded.

to_dict

to_dict() -> dict[str, Any]

A JSON-ready dictionary (includes usable).

diagnose

diagnose(
    *,
    probe: bool = False,
    progid: str = "Access.Application",
) -> Diagnosis

Inspect this machine and report which PyAccessKit engines work.

Parameters:

Name Type Description Default
probe bool

Also build a scratch database with every available engine (starts and closes an owned Access process; takes a few seconds).

False
progid str

The Access ProgID to check (e.g. "Access.Application.16" on multi-version machines).

'Access.Application'