pola-rs/polars · error · TypeError
cannot use glob patterns and integer based projection as…
Error message
cannot use glob patterns and integer based projection as `columns` argument Use columns: List[str]
What it means
Guard in read_ipc when the source is a local glob pattern and `columns` was given as integer indices. Across multiple matched files, positional indices are ambiguous, so only List[str] column selection is supported on the glob path. Pass columns as names.
Solutions
- When using glob patterns, pass columns as a list of column names (List[str]); integer projection cannot be combined with globs.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at py-polars/src/polars/io/ipc/functions.py:263 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pola-rs/polars@68506541d2 (2026-08-19).
Data as JSON: /api/errors/86c7953fde66808b.
Report an issue: GitHub.
Appendix: source
Thrown at py-polars/src/polars/io/ipc/functions.py:263
----------
source
Path to a file or a file-like object (by "file-like object" we refer to objects
that have a `read()` method, such as a file handler like the builtin `open`
function, or a `BytesIO` instance). If `fsspec` is installed, it might be used
to open remote files. For file-like objects, the stream position may not be
updated accordingly after reading.
columns
Columns to select. Accepts a list of column indices (starting at zero) or a list
of column names.
n_rows
Stop reading from IPC stream after reading `n_rows`.
Only valid when `use_pyarrow=False`.
use_pyarrow
Use pyarrow or the native Rust reader.
storage_options
Extra options that make sense for `fsspec.open()` or a particular storage
connection, e.g. host, port, username, password, etc.
row_index_name
Insert a row index column with the given name into the DataFrame as the first
column. If set to `None` (default), no row index column is created.
row_index_offset
Start the row index at this offset. Cannot be negative.
Only used if `row_index_name` is set.
Returns
-------
DataFrame
"""
with prepare_file_arg(
source, use_pyarrow=use_pyarrow, storage_options=storage_options
) as data:
if use_pyarrow:
pyarrow_ipc = import_optional(
"pyarrow.ipc",
err_prefix="",
err_suffix="is required when using 'read_ipc_stream(..., use_pyarrow=True)'",View on GitHub (pinned to 68506541d2)