Hi! Has anyone else used the SMB block with Prefec...
# ask-community
t
Hi! Has anyone else used the SMB block with Prefect 3.x with success? I'm trying to implement it but facing issues similar to this GitHub Issue: https://github.com/PrefectHQ/prefect/issues/10694 Where I get a fsspec/smbprotocol error like this:
Copy code
File "...\.venv\lib\site-packages\smbprotocol\transport.py", line 68, in connect
    raise ValueError(f"Failed to connect to '{self.server}:{self.port}': {err}") from err
ValueError: Failed to connect to 'my.smb.serber.edusmb::445': [Errno 11001] getaddrinfo failed.
When I PDB'd into the stack trace it is the same
_as_unc_path
double appending server as observed in the issue: In `prefect.filesystem.SMB`:
Copy code
# SMB.writepath calls RemoteFileSystem.writepath
# Around line 520
path = self._resolve_path(path)
dirpath = path[: path.rindex("/")]
# dirpath is <smb://my.smb.server.edu/path/to/my/folder>
self.filesystem.makedirs(dirpath, exist_ok=True)
But in `fsspec`:
Copy code
#fsspec/implementation/smb.py
class SMBFileSystem()......
def makedirs(self, path, exist_ok=False):
        # dirpath prefect passes in already contains `<smb://my.smb.server.edu>`
        if _share_has_path(path):
            wpath = _as_unc_path(self.host, path) # <=== This line double appends it
            # now this line would fail because 
            # wpath = \\my.smb.server.edusmb:\\<http://my.smb.server.edu|my.smb.server.edu>\path\to\my\folder
            smbclient.makedirs(wpath, exist_ok=exist_ok, port=self._port)
Has there been any workarounds? Thanks!
@Marvin you too
m
thought for 4.1 seconds
Thanks! If you need anything else with Prefect, just ping me.