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

SMB: Remove unexpected kwargs (coming from UPath.rename) #1391

Merged

Conversation

martin-schulze-e2m
Copy link
Contributor

@martin-schulze-e2m martin-schulze-e2m commented Oct 17, 2023

When using this library through UPath("smb://host/share/file").rename("other_name"), I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/martin/.local/lib/python3.10/site-packages/upath/core.py", line 511, in rename
    self._accessor.mv(
  File "/home/martin/.local/lib/python3.10/site-packages/upath/core.py", line 94, in mv
    return self._fs.mv(
  File "/home/martin/.local/lib/python3.10/site-packages/fsspec/implementations/smb.py", line 254, in mv
    smbclient.rename(wpath1, wpath2, port=self._port, **kwargs)
  File "/home/martin/.local/lib/python3.10/site-packages/smbclient/_os.py", line 483, in rename
    _rename_information(src, dst, replace_if_exists=False, **kwargs)
  File "/home/martin/.local/lib/python3.10/site-packages/smbclient/_os.py", line 1107, in _rename_information
    dst_raw = SMBRawIO(dst, desired_access=FilePipePrinterAccessMask.FILE_EXECUTE, **raw_args)
  File "/home/martin/.local/lib/python3.10/site-packages/smbclient/_io.py", line 362, in __init__
    tree, fd_path = get_smb_tree(path, **kwargs)
TypeError: get_smb_tree() got an unexpected keyword argument 'recursive'

This is due to UPath calling mv with recursive=False, maxdepth=None:

        return self._fs.mv(
            self._format_path(path),
            target,
            recursive=recursive,
            maxdepth=maxdepth,
            **kwargs,
        )

These are forwarded down to get_smb_tree where they are not expected.

There could be interactions with #1335

rename(=true) and maxdepth(=None) that are forwarded to smbprotocol's get_smb_tree which does not want them.
@martindurant martindurant merged commit c20c31a into fsspec:master Oct 19, 2023
11 checks passed
@martin-schulze-e2m
Copy link
Contributor Author

Thanks for the quick response @martin-schulze-e2m. Is there an ETA for a release containing this?

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

Successfully merging this pull request may close these issues.

2 participants