比較的新しいPythonユーザーですので、私にご負担ください。私が取り組んでいるプログラムの一環として、SharePointサイトのフォルダをPythonループにして、各フォルダにファイルをコピーして、ローカルフォルダにコピーを貼り付ける必要があります。私はshutil.copyを使用しようとしていますが、エラーが発生しています(「OSError:[Errno 22] Invalid argument」)。ローカルドライブからファイルをコピーしようとするとエラーは発生しないため、SharePointが問題だと思うようになります。PythonでSharePoint 2007にファイルを保存する
いくつかの調査を行った後、SharePointで動作するようにいくつかのタイプのモジュールをインストールする必要があるようです。これは正確ですか?私は通常、Windowsのエクスプローラを使ってSharePointサイト上のファイルをナビゲート/編集するだけですが?
もう1つの問題は、私の仕事ではまだSharePoint 2007が使用されているため、私の選択肢が制限される可能性があると思います。
ご迷惑をおかけして申し訳ありません。ありがとう!
import xlrd
import shutil
import os
#This is the location of the file on the SharePoint
sp_file = "https://...test.xlsx"
#This is the desired destination locally.
sp_comp_file = "C:\\Users\\555555\\Desktop\\Python Test\\test.xlsx"
shutil.copy(sp_file, sp_comp_file)
エラー:
Traceback (most recent call last):
File "C:\Users\555555\Desktop\Python\teststack.py", line 9, in <module>
shutil.copy(sp_file, sp_comp_file)
File "C:\Users\555555\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 235, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "C:\Users\555555\AppData\Local\Programs\Python\Python36-32\lib\shutil.py", line 114, in copyfile
with open(src, 'rb') as fsrc:
OSError: [Errno 22] Invalid argument: 'https://...test.xlsx'
通常のスタックオーバーフロー規則に従って、コードと完全なエラー出力を送信してください。ありがとう – Justin
@ジャスティン投稿に追加されました。 –