Open aofarrel opened 5 hours ago
It's due to []
being glob characters and glob=True
being the default.
pl.DataFrame({"x": [1]}).write_csv("[foo].csv")
pl.read_csv("[foo].csv", glob=False)
# shape: (1, 1)
# ┌─────┐
# │ x │
# │ --- │
# │ i64 │
# ╞═════╡
# │ 1 │
# └─────┘
pl.read_csv("[foo].csv")
# ComputeError: expected at least 1 source
I'm not sure if some sort of Hint: did you mean glob=False
message could be added in the case when glob chars are present, but no files are matched?
It's due to
[]
being glob characters andglob=True
being the default.pl.DataFrame({"x": [1]}).write_csv("[foo].csv") pl.read_csv("[foo].csv", glob=False) # shape: (1, 1) # ┌─────┐ # │ x │ # │ --- │ # │ i64 │ # ╞═════╡ # │ 1 │ # └─────┘
pl.read_csv("[foo].csv") # ComputeError: expected at least 1 source
I'm not sure if some sort of
Hint: did you mean glob=False
message could be added in the case when glob chars are present, but no files are matched?
Oh, that explains it. Yeah, I think that kind of hint would work, or at least changing the error to a more straightforward file-not-found.
Checks
Reproducible example
Log output
Issue description
In my case data.tsv, identical at both paths, is a three-column valid TSV file, but this seems to happen on basically any TSV/CSV as long as there are square brackets in the path somewhere. File is attached (extension changed to .txt to keep GitHub happy)
data.tsv.txt
Expected behavior
The behavior of
and
should be identical, just like how they are identical when opening with standard python open(). If polars can't accept square brackets in a path, it should throw an error saying so when brackets are present, or just throw a file-not-found error.
Installed versions