eshmu / gphotos-upload

Simple but flexible script to upload photos to Google Photos and add to a particular album. Useful if you have photos in a directory structure that you want to reflect as Google Photos albums.
145 stars 54 forks source link

Error while uploading video files >2GB #13

Open rstl-2015 opened 4 years ago

rstl-2015 commented 4 years ago

Uploading video files >2GB doesn't work

Error log

Traceback (most recent call last): File "upload.py", line 206, in main() File "upload.py", line 196, in main upload_photos(session, args.photos, args.album_name) File "upload.py", line 156, in upload_photos upload_token = session.post('https://photoslibrary.googleapis.com/v1/uploads', photo_bytes) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/requests/sessions.py", line 572, in post return self.request('POST', url, data=data, json=json, kwargs) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/google/auth/transport/requests.py", line 201, in request method, url, data=data, headers=request_headers, kwargs) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/requests/sessions.py", line 524, in request resp = self.send(prep, send_kwargs) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/requests/sessions.py", line 637, in send r = adapter.send(request, kwargs) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/requests/adapters.py", line 449, in send timeout=timeout File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/Users/yusuf/.local/share/virtualenvs/gphotos-upload-master-Q2NAzFMA/lib/python3.7/site-packages/urllib3/connectionpool.py", line 354, in _make_request conn.request(method, url, **httplib_request_kw) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", line 1055, in _send_output self.send(chunk) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", line 977, in send self.sock.sendall(data) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/ssl.py", line 1015, in sendall v = self.send(byte_view[count:]) File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/ssl.py", line 984, in send return self._sslobj.write(data) OverflowError: string longer than 2147483647 bytes

ghost commented 4 years ago

There are no possible known way to bypass "OverflowError: string longer than 2147483647 bytes" unless you want to risk of breaking the gphotos-upload code and mine has different between paths and line numbers The only solution is to compress video until it's size is under than 2147483647 bytes.

Traceback (most recent call last): File "upload.py", line 206, in main() File "upload.py", line 196, in main upload_photos(session, args.photos, args.album_name) File "upload.py", line 156, in upload_photos upload_token = session.post('https://photoslibrary.googleapis.com/v1/uploads', photo_bytes) File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 578, in post return self.request('POST', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.6/dist-packages/google/auth/transport/requests.py", line 450, in request kwargs File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 530, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 643, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send timeout=timeout File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 600, in urlopen chunked=chunked) File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 354, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib/python3.6/http/client.py", line 1264, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1310, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1259, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.6/http/client.py", line 1077, in _send_output self.send(chunk) File "/usr/lib/python3.6/http/client.py", line 998, in send self.sock.sendall(data) File "/usr/lib/python3.6/ssl.py", line 975, in sendall v = self.send(byte_view[count:]) File "/usr/lib/python3.6/ssl.py", line 944, in send return self._sslobj.write(data) File "/usr/lib/python3.6/ssl.py", line 642, in write return self._sslobj.write(data) OverflowError: string longer than 2147483647 bytes