2

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

slypete
  • 5,538
  • 11
  • 47
  • 64

2 Answers2

4

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

askvictor
  • 3,621
  • 4
  • 32
  • 45
0

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.

Community
  • 1
  • 1
Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395