我的 NAS 上有一个桑巴共享,可以在 R/W 中作为访客访问。
从我的覆盆子上的python脚本中,我想发送一些文件。
我制作了以下脚本:
from shutil import copyfile
copyfile('/home/pi/Test/README.md', r'\192.168.0.30Publictest')
我没有错误,但文件未发送到我的 NAS。
知道我做错了什么吗?
最后我
创建了一个网络共享:
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)
现在复制工作。不是我真正想要的,但至少它有效。