Connecting to SMB share in python

Discussion in 'Python' started by Ronnie Kwok, Sep 25, 2008.

  1. Ronnie Kwok

    Ronnie Kwok Guest

    Hello,

    I am trying to write a script that copy files from my local machine to a samba
    share.

    I've notice a library call Pysamba which is a wrapper on smb service but it
    requires a compilation of SAMBA with some amendment in order to use it.

    Are there alternative method that I could do the same thing?

    Thank you for your advise.

    ronnie
    Ronnie Kwok, Sep 25, 2008
    #1
    1. Advertising

  2. Ronnie Kwok

    Tim Golden Guest

    Ronnie Kwok wrote:
    > Hello,
    >
    > I am trying to write a script that copy files from my local machine to a samba
    > share.



    Can't you just mount the share (albeit temporarily) and copy
    the files over in the normal way? You haven't said what OS
    you're on, but I'm assuming Linux otherwise you'd simply be
    talking about a Windows share and copying to a UNC.

    TJG
    Tim Golden, Sep 25, 2008
    #2
    1. Advertising

  3. Ronnie Kwok

    Ronnie Kwok Guest

    Thank you for the reply!

    Yes, I am running the script under linux and it will be doing some
    processing before copying it over to the samba mount.

    It's totally fine to mount it with os.sys(...) approach but I am just
    thinking if there's other option.

    ronnie


    On 2008-09-25 16:36:35 +0800, Tim Golden <> said:

    > Ronnie Kwok wrote:
    >> Hello,
    >>
    >> I am trying to write a script that copy files from my local machine to a samba
    >> share.

    >
    >
    > Can't you just mount the share (albeit temporarily) and copy
    > the files over in the normal way? You haven't said what OS
    > you're on, but I'm assuming Linux otherwise you'd simply be
    > talking about a Windows share and copying to a UNC.
    >
    > TJG
    Ronnie Kwok, Sep 25, 2008
    #3
  4. Ronnie Kwok wrote:

    > Thank you for the reply!
    >
    > Yes, I am running the script under linux and it will be doing some
    > processing before copying it over to the samba mount.
    >
    > It's totally fine to mount it with os.sys(...) approach but I am just
    > thinking if there's other option.


    None that is any more comfortable. If anything, you'd need smbclient or some
    such to list and fetch data - which is *much* more complicated that simply
    mounting a share defined in fstab.

    Diez
    Diez B. Roggisch, Sep 25, 2008
    #4
  5. Ronnie Kwok

    Tim Golden Guest

    Ronnie Kwok wrote:
    > Yes, I am running the script under linux and it will be doing some
    > processing before copying it over to the samba mount.
    >
    > It's totally fine to mount it with os.sys(...) approach but I am just
    > thinking if there's other option.



    I'm not really a Linux person but from all I can see
    from Googling around a bit, the os.system ("mount/unmount")
    option is still the most viable. Hopefully someone with
    real expertise can chip in.

    BTW, opinion in this ng/mailing list tends to favour
    bottom-posting or interleaved posting.

    TJG
    Tim Golden, Sep 25, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Granger Godbold
    Replies:
    3
    Views:
    5,005
    Granger Godbold
    Jul 3, 2004
  2. john bailo

    using SMB as filesystem mounts

    john bailo, Sep 10, 2003, in forum: Java
    Replies:
    3
    Views:
    396
    Davide Consonni
    Sep 11, 2003
  3. Atila Olah

    Python and SMB, again...

    Atila Olah, Sep 12, 2005, in forum: Python
    Replies:
    4
    Views:
    3,146
    Atila Olah
    Sep 14, 2005
  4. Saraswati lakki
    Replies:
    0
    Views:
    1,287
    Saraswati lakki
    Jan 6, 2012
  5. John
    Replies:
    0
    Views:
    165
Loading...

Share This Page