You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
If you pass a str to pl.read_csv, it assumes it's a CSV file path. At the same time, pl.read_csv accepts a bytes and it treats it as content.
One common user mistake is to pass in a str with the CSV contents, instead of a bytes. In this case, Polars outputs the str back in the exception message, assuming it's a path. But if the str is large (megabytes), it becomes very hard to diagnose what the actual problem is, since you can't see the beginning of the actual error message.
2-5
changed the title
pl.scan_csv with string content (not bytes) outputs whole content in exception message
pl.read_csv with string content (not bytes) outputs whole content in exception message
Feb 13, 2023
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
If you pass a
str
topl.read_csv
, it assumes it's a CSV file path. At the same time,pl.read_csv
accepts abytes
and it treats it as content.One common user mistake is to pass in a
str
with the CSV contents, instead of abytes
. In this case, Polars outputs thestr
back in the exception message, assuming it's a path. But if thestr
is large (megabytes), it becomes very hard to diagnose what the actual problem is, since you can't see the beginning of the actual error message.Reproducible example
Outputs:
Expected behavior
Polars trims the assumed path in the error message of
pl.read_csv
to a sane value (1000 chars, ...)Installed versions
The text was updated successfully, but these errors were encountered: