Skip to content

scan_fwf fails to read example text file encoded as cp1252 #10

@mondjef

Description

@mondjef

scan_fwf fails to read example posted fixed width text file using the following code. Error raised, PanicException: Python API call failed. Seems that the first 'É' encountered is what is causing it.

Example test file:
https://github.com/user-attachments/files/21219300/test.txt

import polars as pl
import polars_io as pio

cols = {'seq': (0,9),
        'id': (9,24),
        'input_text': (24,144)
        }

df = pio.scan_fwf(r"path\test.txt", 
                  cols, 
                  infer_schema_length=0, 
                  encoding='cp1252',
                  has_header=False,
                  separator='\x00',
                  quote_char=None
                  )

df.head().collect()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions