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
這可能是有用的.. !! –