Webdav connection

I am a new swan user.
I trying to copy a file from my cernbox to an IT web server using webdav3.
It works with my local machine, but not from swan.
The webdav connection seems to be valid, but I have access to no resource.
Thanks for help

Dear Frédéric,

SWAN uses CERNBox for storing notebooks and related files, the rationale being that having a single storage between these two services allows for a unified view of files and folders and for the use of advanced features (sync, sharing) for notebooks.

You should be able to copy the files you want from CERNBox via WebDAV even if they were created or modified by SWAN.
If you need to copy such files form SWAN, I would need to better understand your workflow and the error you report (“I have access to no resource”) to provide support.

Kind regards,

Hi Enrico,

Thanks for the reply. Actually I found another way to do what I wanted using Confluence as a website.

But, here is what I was doing. I was trying to “publish” automatically a web-page I created in my Swan environment. The page is store in my CERNBox, and I want to upload it to my website (hosted by IT). That’s why I thought about webdav. Here is what I had in the code:

from webdav3.client import Client
options = {
‘webdav_hostname’: “https://dfs.cern.ch/dfs/websites/t/test-be-ics-stats”,
‘webdav_login’: user,
‘webdav_password’: password

#webdav connection
client = Client(options)

The result was:

User: fchapron
Enter password: ········
WARNING:root:Connecting to server

RemoteParentNotFound Traceback (most recent call last)
283 #webdav connection
284 client = Client(options)
–> 285 client.upload(“Default.htm”,“BE-ICS-TI-Gantt-Chart-statistics.htm”)
287 print(“End of script”)

~/.local/lib/python3.7/site-packages/webdav3/client.py in upload(self, remote_path, local_path, progress)
436 self.upload_directory(local_path=local_path, remote_path=remote_path, progress=progress)
437 else:
–> 438 self.upload_file(local_path=local_path, remote_path=remote_path)
440 def upload_directory(self, remote_path, local_path, progress=None):

~/.local/lib/python3.7/site-packages/webdav3/client.py in _wrapper(self, *args, **kw)
63 log.debug(“Requesting %s(%s, %s)”, fn, args, kw)
64 try:
—> 65 res = fn(self, *args, **kw)
66 except requests.ConnectionError:
67 raise NoConnection(self.webdav.hostname)

~/.local/lib/python3.7/site-packages/webdav3/client.py in upload_file(self, remote_path, local_path, progress)
488 if not self.check(urn.parent()):
–> 489 raise RemoteParentNotFound(urn.path())
491 with open(local_path, “rb”) as local_file:

RemoteParentNotFound: Remote parent for: /Default.htm not found

So, as I succeeded to fulfill my needs in a another way, I don’t want to waist your time, we can forget this issue, but if we can solve it, it might be useful in future.


Hello Frédéric,

Could you please try to set the root directory you want to write to as a separate parameters and not in the hostname?

Example with my home directory on DFS:

from webdav3.client import Client

# Webdav connection
options = {
'webdav_hostname': "https://dfs.cern.ch",
'webdav_root': 'dfs/users/e/ebocchi',
'webdav_login': %%USERNAME%%,
'webdav_password': %%PASSWORD%%
client = Client(options)
print ("$HOME: ", client.list())

# Desktop is initially empty
print ("Desktop: ", client.list('Desktop/'))

# Create and upload a test file
with open('test.log', 'w') as fout:
    fout.write("This is a test file")
client.upload(remote_path='Desktop/test.uploaded.log', local_path='test.log')

# Desktop now contains 'test.uploaded.log'
print ("Desktop: ", client.list('Desktop/'))

Output of the snippet:

$HOME:  ['Contacts/', 'Desktop/', 'Documents/', 'Favorites/', 'Links/', 'Public/']
Desktop:  []
Desktop:  ['test.uploaded.log']