写真を Google ドライブにアップロードするスクリプトを作成したいと考えています。Google Document List API を数時間掘り下げた後。gdata-python-client 2.0.17(最新) を選択してスクリプトをビルドします。ファイルをコレクションにアップロードできないことを除いて、すべてがうまく機能します。ここに例外があります。
トレースバック (最新の呼び出しが最後): ファイル「./upload.py」の 27 行目 アップロード (sys.argv[1]) ファイル「./upload.py」、22 行目、アップロード client.create_resource(p、コレクション=f、メディア=ms) ファイル "/usr/local/lib/python2.7/dist-packages/gdata/docs/client.py"、300 行目、create_resource 内 return uploader.upload_file(create_uri, entry, **kwargs) ファイル "/usr/local/lib/python2.7/dist-packages/gdata/client.py"、1090 行目、upload_file 内 start_byte, self.file_handle.read(self.chunk_size)) ファイル "/usr/local/lib/python2.7/dist-packages/gdata/client.py"、1048 行目、upload_chunk 内 エラーを発生させる gdata.client.RequestError: サーバーの応答: 400、<errors xmlns='http://schemas.google.com/g/2005'><error><domain>GData</domain><code>InvalidEntryException</code ><internalReason>申し訳ありませんが、サーバー エラーが発生しました。もう一度やり直してください。</internalReason></error></errors>
gdata のソース コードをハッキングした後、デバッグ用にいくつかの情報を出力します。
> 範囲: バイト 0 ~ 524287/729223 送信先: https://docs.google.com/feeds/upload/create-session/default/private/full/folder%3A0B96cfHivZx6ddGFwYXVCbzc4U3M/contents?upload_id=AEnB2UqnYRFTOyCCIGIESUIctWg6hvQIHY4JRMnL-CUQhHii3RGMFWZ12a7lXWd1hgVzhd8Fmhwfwzhd1Fmhwfwzhd1Vql > 範囲: バイト 524288 ~ 729222/729223 送信先: https://docs.google.com/feeds/upload/create-session/default/private/full/folder%3A0B96cfHivZx6ddGFwYXVCbzc4U3M/contents?upload_id=AEnB2UqnYRFTOyCCIGIESUIctWg6hvQIHY4JRMnL-CUQhHii3RGMFWZ12a7lXWd1hgVzhd8Fmhwfwzhd1Fmhwfwzhd1Vql
PUT
ファイルの最後の部分で発生する例外。