Skip to content

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

Open

Description

@chross

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

Activity

  1. Nayar commented on Mar 3, 2018

    @Nayar

    Same issue here. Found anything?

  2. wavefrontshaping commented on Mar 25, 2018

    @wavefrontshaping

    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().

  3. wavefrontshaping commented on Mar 25, 2018

    @wavefrontshaping

    Nevermind, I found the solution to my issue here:
    #18

    Are you by any chance using webdav with Owncloud too?

  4. pingyangtiaer commented on Apr 11, 2018

    @pingyangtiaer

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

  5. alexagv commented on Aug 16, 2018

    @alexagv

    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')
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions