Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/unitxt/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,8 @@ def split_generator(self, split: str) -> Generator:
except ValueError:
import fsspec

with fsspec.open(file, mode="rt") as file:
dataframe = self.read_dataframe(file)
with fsspec.open(file, mode="rt") as f:
dataframe = self.read_dataframe(f)
break
except Exception as e:
logger.warning(f"Attempt load {attempt + 1} failed: {e}")
Expand Down Expand Up @@ -539,8 +539,7 @@ def read_dataframe(self, file) -> pd.DataFrame:
if self.column_names is not None:
args["names"] = self.column_names
args["header"] = None # Don't use first row as header
if self.indirect_read:
# Open the URL with urllib first to mitigate HTTP errors that sometime happen with the internal pandas implementation
if self.indirect_read and isinstance(file, str):
from urllib import request

with request.urlopen(file) as response:
Expand Down
Loading