8000 pyexcel assumes dest_file_name is a str, does not tolerate pathlib.Path · Issue #267 · pyexcel/pyexcel · GitHub
[go: up one dir, main page]

Skip to content
pyexcel assumes dest_file_name is a str, does not tolerate pathlib.Path #267
@root-11

Description

@root-11

During keyword ingestion in:

def isave_as(**keywords):

pyexcel assumes dest_file_name is a str, does not tolerate pathlib.Path

Here's an example:

>>> pyexcel.save_as(array=data, dest_file_name=path)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\core.py", line 82, in save_as
    return sources.save_sheet(sheet, **dest_keywords)
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\internal\core.py", line 46, in save_sheet
    a_source = SOURCE.get_writable_source(**keywords)
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\internal\source_plugin.py", line 91, in get_writable_source
    return self.get_a_plugin(
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\internal\source_plugin.py", line 69, in get_a_plugin
    source_cls = self.load_me_now(
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\internal\source_plugin.py", line 41, in load_me_now
    if source.is_my_business(action, **keywords):
  File "C:\Data\venv\tablite310\lib\site-packages\pyexcel\plugins\__init__.py", line 56, in is_my_business
    raise IOError("Unsupported file type")
OSError: Unsupported file type

^--- This is not a useful error message for this input ---v

>>> path
WindowsPath('C:/Users/madsenbj/AppData/Local/Temp/junk_test/myfile.xlsx')
>>> pyexcel.save_as(array=data, dest_file_name=str(path))
>>>

If anything it should be TypeError(f"expected str, got {type(dest_file_name)}")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0