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

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

Open
chross opened this issue Feb 11, 2018 · 5 comments
Open

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

chross opened this issue Feb 11, 2018 · 5 comments

Comments

@chross
Copy link

chross commented Feb 11, 2018

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
@Nayar
Copy link

Nayar commented Mar 3, 2018

Same issue here. Found anything?

@wavefrontshaping
Copy link

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
Copy link

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

Are you by any chance using webdav with Owncloud too?

@pingyangtiaer
Copy link

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

@alexagv
Copy link

alexagv commented Aug 16, 2018

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants