pathwaycom/pathway · error · TypeError

'{param_name}' must be a number of seconds (int or float) or

Error message

'{param_name}' must be a number of seconds (int or float) or a datetime.timedelta, got {type(value).__name__}

What it means

Error "'{param_name}' must be a number of seconds (int or float) or a datetime.timedelta, got {type(value).__name__}" thrown in pathwaycom/pathway.

Source

Thrown at python/pathway/io/_utils.py:121

    converted with ``total_seconds()``.

    Args:
        value: The value of the parameter to be coerced.
        param_name: The name of the parameter, used in error messages.
        allow_zero: If ``True`` (the default), a zero duration is accepted: for
            polling-type intervals it is a legitimate way to ask for updates as
            often as possible, at the price of a busy-wait loop. Set to ``False``
            for parameters where zero can never be meaningful (e.g. timeouts).

    Returns:
        The duration expressed as a float number of seconds.
    """
    if isinstance(value, datetime.timedelta):
        seconds = value.total_seconds()
    elif isinstance(value, (int, float)) and not isinstance(value, bool):
        seconds = float(value)
    else:
        raise TypeError(
            f"'{param_name}' must be a number of seconds (int or float) or a "
            f"datetime.timedelta, got {type(value).__name__}"
        )
    if not math.isfinite(seconds):
        raise ValueError(f"'{param_name}' must be finite, got {value!r}")
    if seconds < 0 or (seconds == 0 and not allow_zero):
        constraint = "non-negative" if allow_zero else "positive"
        raise ValueError(f"'{param_name}' must be {constraint}, got {value!r}")
    return seconds


class RawDataSchema(pw.Schema):
    data: bytes


class PlaintextDataSchema(pw.Schema):
    data: str

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Pass the duration parameter as a number of seconds (int/float) or a datetime.timedelta instead of the value that was given.

Example fix

pw.io.fs.read(path, refresh_interval=60)  # or refresh_interval=datetime.timedelta(minutes=1)

When it happens

Trigger: Thrown at python/pathway/io/_utils.py:121 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/6bbf8f06a53403d3. Report an issue: GitHub.