Skip to content

Commit

Permalink
Fixed bugs in new implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Jul 25, 2023
1 parent 86686c8 commit 2999c9c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions table_step/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,23 @@ def description_text(self, P=None):
filename = P["filename"]
file_type = P["file type"]
if file_type == "from extension":
if self.is_expr(filename):
if isinstance(filename, str) and self.is_expr(filename):
lines.append(
f" File: from variable '{filename}' with type from the "
"extension"
)
file_type = PurePath(filename).suffix
if file_type not in self.parameters["file type"].enumeration:
types = "', '".join(self.parameters["file type"].enumeration)
raise RuntimeError(
f"Cannot handle files of type '{file_type}' when reading "
f"table '{tablename}'.\nKnown types: '{types}'"
else:
file_type = PurePath(filename).suffix
if file_type not in self.parameters["file type"].enumeration:
types = "', '".join(self.parameters["file type"].enumeration)
raise RuntimeError(
f"Cannot handle files of type '{file_type}' when reading "
f"table '{tablename}'.\nKnown types: '{types}'"
)
lines.append(
f" File: '{filename}' with type '{file_type}' from the "
"extension."
)
lines.append(
f" File: '{filename}' with type '{file_type}' from the "
"extension."
)
else:
lines.append(f" File: '{filename}' with type '{file_type}'")
elif method == "Save":
Expand Down

0 comments on commit 2999c9c

Please sign in to comment.