How to create file on Samba
#1
Hi,

I receive error when trying to create a new file on Samba using following code:

f=open('smb://hs-d123as/share/work[/align]file', 'w')

Note: The path is defined by Kodi Folder browsing.

Can anybody please help me to do this correctly ?

Thanks a lot in advance for your help,
sviet
Reply
#2
Python standard file tools do not support network filesystems. Fortunately xbmcvfs module provides File class with similar interface which does support network paths.

Code:
from contextlib import closing
from xbmcvfs import File

with closing(File('smb://your/path.ext', 'w')) as fo:
    fo.write(somedata)
Reply
#3
Thanks a lot for your quick help. It's working Smile
Reply

Logout Mark Read Team Forum Stats Members Help
How to create file on Samba0