webdav-client-python icon indicating copy to clipboard operation
webdav-client-python copied to clipboard

client.check works but client.info can't find the remote file

Open chross opened this issue 7 years ago • 5 comments

The following code is working

  client.check(remote_path) #returns true (file is present)
  client.list() #lists all files correctly

but the following statements won't work

    print(client.info("0000249385.zip").size)
    print(client.info(remote_path))

The whole code:

def downloadFile(id):
    remote_path = id + ".zip"
    local_path = "C:/User/i/Desktop/" + id + ".zip"
    
    import webdav.client as wc

    options = {
     'webdav_hostname': "https://server.com:8081/Testfolder/",
     'webdav_login':    "user",
     'webdav_password': 'password'
    }
    client = wc.Client(options)
    client.webdav.is_valid()
    client.default_options['SSL_VERIFYPEER'] = False 
    client.default_options['SSL_VERIFYHOST'] = False
    #this statement list all files correctly
    print(client.list())
    #returns true (as expected)
    print(client.check(remote_path))

The error from the Python IDLE console

===== RESTART: C:/Users/i/AppData/Local/Programs/Python/Python36/test.py =====
['Testfolder/', '@Recycle/', '0000249385.zip', 'index.txt']
Traceback (most recent call last):
  File "C:/Users/i/AppData/Local/Programs/Python/Python36/test.py", line 62, in <module>
    downloadFile("0000249385")
  File "C:/Users/i/AppData/Local/Programs/Python/Python36/test.py", line 21, in downloadFile
    print(client.info("0000249385.zip").size)
  File "C:\Users\i\AppData\Local\Programs\Python\Python36\lib\site-packages\webdav\client.py", line 803, in info
    return parse(response, path)
  File "C:\Users\i\AppData\Local\Programs\Python\Python36\lib\site-packages\webdav\client.py", line 776, in parse
    raise RemoteResourceNotFound(path)
webdav.exceptions.RemoteResourceNotFound: Remote resource: /0000249385.zip not found

chross avatar Feb 11 '18 15:02 chross

Same issue here. Found anything?

Nayar avatar Mar 03 '18 10:03 Nayar

Hi,

Same here, I am also interested in finding how to fix that. I can list() the directories/files, check() returns True but I cannot use info() or download_sync().

wavefrontshaping avatar Mar 25 '18 16:03 wavefrontshaping

Nevermind, I found the solution to my issue here: https://github.com/CloudPolis/webdav-client-python/issues/18

Are you by any chance using webdav with Owncloud too?

wavefrontshaping avatar Mar 25 '18 16:03 wavefrontshaping

I had the same issue, webdav.exceptions.RemoteResourceNotFound: Is there anyone can help

pingyangtiaer avatar Apr 11 '18 15:04 pingyangtiaer

I was facing the same issue here as well... I could list() and check() returned true, but could not download the file. Fixed the problem by using webdav_root:

    options = {
    'webdav_hostname': 'http://192.168.1.101:5050',
    'webdav_root': "/"
    }
    client = wc.Client(options)
    if client.check("test.txt"):
        print(client.info("test.txt"))
        client.download("test.txt", '~/Downloads')

alexagv avatar Aug 16 '18 16:08 alexagv