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

Can list() files, but cannot download. "Remote resource not found" #145

Open
sunithb opened this issue Apr 3, 2024 · 1 comment
Open

Comments

@sunithb
Copy link

sunithb commented Apr 3, 2024

python 3.11
webdav3 3.14.5

I can connect to the WebDAV server (NextCloud) and list the files as follows:

client.list("Transfer/openvino/carpet/") 

['carpet/', 'metadata.json', 'model.bin', 'model.onnx', 'model.xml', 'notebook1.py', 'openvino_inferencer.py', 'test.zip']

But when I try to download 'model.bin', I get the following error

client.download_file("Transfer/openvino/carpet/model.bin","~/model.bin") 

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 67, in _wrapper
    res = fn(self, *args, **kw)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 447, in download_file
    if self.is_dir(urn.path()):
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 67, in _wrapper
    res = fn(self, *args, **kw)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 781, in is_dir
    return WebDavXmlUtils.parse_is_dir_response(content=response.content, path=path, hostname=self.webdav.hostname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 1164, in parse_is_dir_response
    response = WebDavXmlUtils.extract_response_for_path(content=content, path=path, hostname=hostname)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/device1531/openvino_env/lib/python3.11/site-packages/webdav3/client.py", line 1251, in extract_response_for_path
    raise RemoteResourceNotFound(path)
webdav3.exceptions.RemoteResourceNotFound: Remote resource: /Transfer/openvino/carpet/model.bin not found
@FaKe2008
Copy link

I had the same problem. In my case, it was because I had already indicated part of the path in the webdav_host_address. With this information, the response of the WebDAV server could not be parsed correctly. Since I had no influence on the specification of the webdav_host_address, I helped myself by using prefix = urlparse(webdav_host_address).path (module urllib.parse), removing the prefix from the webdav_host_address and prefixing it again later to get and put calls.

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

2 participants