When I try to run the below function:
import polars as pl
from polars_encryption import encrypt, decrypt
def crypt(csv_file: str, delim: str, password: str, output_file: str):
"""
Save CSV to encrypted Parquet by encrypting all columns
- csv_file: CSV file path (without .csv extension)
- delim: CSV delimiter
- password: Your encryption password
- output_file: Output Parquet filename
"""
# Read CSV
df = pl.read_csv(f"{csv_file}.csv", separator=delim, encoding="UTF-8-SIG")
# Pad/truncate password to 32 bytes (AES-256 key size)
key = (password.encode() + b'\0'*32)[:32]
nonce = b'minimal_nonce_' # 12-byte fixed nonce
# Encrypt all columns
encrypted_df = df.with_columns([
encrypt(pl.col(col_name), key=key, nonce=nonce).alias(col_name)
for col_name in df.columns
])
# Save encrypted DataFrame
encrypted_df.write_parquet(output_file)
With the below perameters:
crypt(csv_file = file, delim = ';', password = 'testpass', output_file = 'new.pa')
I get the following error:
ComputeError: the plugin panicked
The message is suppressed. Set POLARS_VERBOSE=1 to send the panic message to stderr.
Can anyone help me fix this?