Send a file on a samba share from python script -
i've samba share on nas, accessible in r/w guest.
from python script on raspberry, send file.
i've made following script:
from shutil import copyfile copyfile('/home/pi/test/readme.md', r'\\192.168.0.30\public\test')
i've no errors, file not send nas.
any idea i'm doing wrong?
i ended creating network share:
import subprocess remotehost="192.168.0.30" remoteshare="public" remotesubfolder="test" remoteuser='picam' remotepassword='picam' localmountpoint = '/mnt/remoteserver' destinationfolder = localmountpoint+'/'+remotesubfolder if not os.path.exists(localmountpoint): os.makedirs(localmountpoint) command = "sudo mount -t cifs -o username="+remoteuser+",password="+remotepassword+" //"+remotehost+"/"+remoteshare+" "+localmountpoint logmsg("executing mounting command: "+command) subprocess.popen(command, shell=true)
and copy work. not hopping @ least works.
Comments
Post a Comment