slypete
slypete

Reputation: 5648

Connect to a samba share with python in a platform independent manner?

Is there an abstraction that will allow me to 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

Upvotes: 2

Views: 7155

Answers (2)

askvictor
askvictor

Reputation: 3819

pysmb seems to do this: https://miketeo.net/wp/index.php/projects/pysmb (edited with new link)

Upvotes: 4

Alex Martelli
Alex Martelli

Reputation: 881695

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.

Upvotes: 0

Related Questions