Skip to content

Commit 97e8d3a

Browse files
committed
fix: ensure \r not in table_names on Windows
1 parent 2c7520d commit 97e8d3a

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/polars_access_mdbtools/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@ def list_table_names(db_path: str | Path) -> list[str]:
3636
:param db_path: The MS Access database file.
3737
:return: A list of the tables in a given database.
3838
"""
39-
tables = subprocess.check_output( # noqa: S603
40-
["mdb-tables", "--single-column", _path_to_cmd_str(db_path)], # noqa: S607
41-
).decode()
42-
return tables.strip().split("\n")
39+
tables = (
40+
subprocess.check_output( # noqa: S603
41+
["mdb-tables", "--single-column", _path_to_cmd_str(db_path)], # noqa: S607
42+
)
43+
.decode()
44+
.replace("\r\n", "\n")
45+
.strip()
46+
)
47+
return tables.split("\n")
4348

4449

4550
def _convert_data_type_from_access_to_polars( # noqa: C901, PLR0911, PLR0912

0 commit comments

Comments
 (0)