nautechsystems/nautilus_trader · error · AttributeError

module has no attribute

Error message

module {__name__!r} has no attribute {name!r}

What it means

Module-level __getattr__ in the testkit providers lazily re-exports only the four pandas-dependent loaders (CSVBarDataLoader, CSVTickDataLoader, ParquetBarDataLoader, ParquetTickDataLoader); any other unresolved attribute name falls through to this standard AttributeError sentinel.

Solutions

  1. Check the attribute spelling against the testkit module contents
  2. Import the data loaders directly from nautilus_trader.persistence.loaders
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at python/nautilus_trader/testkit/providers.py:93 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/523339c62905cc98. Report an issue: GitHub.

Appendix: source

Thrown at python/nautilus_trader/testkit/providers.py:93

    "https://raw.githubusercontent.com/nautechsystems/nautilus_trader/{branch}/test_data/{path}"
)
_DEFAULT_BRANCH = "develop"


def __getattr__(name: str) -> Any:
    # Lazily re-export the data loaders (which require pandas) so that the
    # instrument factories remain importable without pandas installed
    if name in (
        "CSVBarDataLoader",
        "CSVTickDataLoader",
        "ParquetBarDataLoader",
        "ParquetTickDataLoader",
    ):
        from nautilus_trader.persistence import loaders

        return getattr(loaders, name)

    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")


def _read_test_data(path: str, branch: str = _DEFAULT_BRANCH) -> bytes:
    if TEST_DATA_DIR.exists():
        return (TEST_DATA_DIR / path).read_bytes()

    url = _GITHUB_RAW_URL.format(branch=branch, path=path)
    with urllib.request.urlopen(url) as response:  # noqa: S310  # Fixed https scheme
        return response.read()


def _open_test_data_text(path: str) -> io.StringIO:
    return io.StringIO(_read_test_data(path).decode("utf-8"))


def _parse_iso_to_ns(value: str) -> int:
    s = value.strip()
    if "+" not in s and not s.endswith("Z"):

View on GitHub (pinned to 18893faf8b)