1
我有一个Odoo8在我的Linux服务器上运行,我需要从这台服务器上的文件复制到Windows 10共享文件夹与身份验证。 我试图做到这一点编程这样的:通过网络在odoo网络写身份验证
full_path = "smb://hostname/shared_folder/other_path"
if not os.path.exists(full_path):
os.makedirs(full_path)
full_path = os.path.join(full_path, file_name)
bin_value = stream.decode('base64')
if not os.path.exists(full_path):
try:
with open(full_path, 'wb') as fp:
fp.write(bin_value)
fp.close()
return True
except IOError:
_logger.exception("stream_save writing %s", full_path)
,但即使不发生异常,不创建文件夹和文件不被写入。 然后我试图从uri中删除“smb:”部分,它引发了关于认证的异常。
我想通过使用python解决这个问题,可能会避免os.system调用或外部脚本,但如果没有其他方式可行,那么任何建议是值得欢迎的。
我也试图与
"//user:[email protected]"
和
"//domain;user:[email protected]"
既没有SMB
这可能是有用的.. !! –