Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
root-11 opened this issue Aug 7, 2022 · 0 comments
Open

Comments

@root-11
Copy link

root-11 commented Aug 7, 2022

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)}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant