Is there an abstraction that will allow me to 开发者_JAVA百科connect to a samba share in python regardless of my platform?
More information
I do not want to mount a share. I simply want to upload files to a share, such as smbclient's put.
Thanks, Pete
pysmb seems to do this: https://miketeo.net/wp/index.php/projects/pysmb (edited with new link)
As per this question, I would use subprocess
to execute a mount
command in Unix-y systems (most all of them save windows) -- and mountvol
on windows, which that SO question doesn't mention. It's a tiny difference in the string to pass to subprocess
, easy to encapsulate in a tiny function, which may be the reason I don't think there's any "third party solution" to this issue -- it's just too small an issue;-).
If you don't want to mount the filesystem, nosklo (a frequent SO poster) has made available a package to access the filesystem directly, but I haven't tried that.
精彩评论