google / gdata-python-client

444 stars 228 forks source link

InsertPhotoSimple - [Errno 32] Broken Pipe #53

Open gblanchard4 opened 7 years ago

gblanchard4 commented 7 years ago

I am using TouchSelfie to create a simple photobooth. It should allow me to upload photos to a Google photos album, and was working yesterday. Today the uploading feature seemed to stop.

I can query my photo albums successfully using the following example code:

photos = client.GetFeed(album_url)
for photo in photos.entry:
    print 'Photo title:', photo.title.text

Since the photos in that album get printed, I presume my credentials are working fine.

But if I try to upload a photo using the InsertPhotoSimple function I get error: [Errno 32] Broken pipe The InsertPhotoSimple code I am using is straight from the API Documentation

client.InsertPhotoSimple(album_url, 'Test Photo', 'Testing API', "myphoto.png", content_type='image/png')

I can't figure it out what happened! My codebase didn't change, but now I am getting errors. Any help is appreciated!

The full stack trace:

client.InsertPhotoSimple(album_url, 'AYYY', 'Test API', "logo.png", content_type='image/png')
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-72-ffbac228ff15> in <module>()
----> 1 client.InsertPhotoSimple(album_url, 'AYYY', 'Test API', "logo.png", content_type='image/png')

/usr/lib/python2.7/dist-packages/gdata/photos/service.pyc in InsertPhotoSimple(self, album_or_uri, title, summary, filename_or_handle, content_type, keywords)
    468       metadata.media.keywords = gdata.media.Keywords(text=keywords)
    469     return self.InsertPhoto(album_or_uri, metadata, filename_or_handle,
--> 470       content_type)
    471
    472   def UpdatePhotoMetadata(self, photo):

/usr/lib/python2.7/dist-packages/gdata/photos/service.pyc in InsertPhoto(self, album_or_uri, photo, filename_or_handle, content_type)
    424     try:
    425       return self.Post(photo, uri=feed_uri, media_source=mediasource,
--> 426         converter=gdata.photos.PhotoEntryFromString)
    427     except gdata.service.RequestError, e:
    428       raise GooglePhotosException(e.args[0])

/usr/lib/python2.7/dist-packages/gdata/service.pyc in Post(self, data, uri, extra_headers, url_params, escape_params, redirects_remaining, media_source, converter)
   1233         extra_headers=extra_headers, url_params=url_params,
   1234         escape_params=escape_params, redirects_remaining=redirects_remaining,
-> 1235         media_source=media_source, converter=converter)
   1236
   1237   def PostOrPut(self, verb, data, uri, extra_headers=None, url_params=None,

/usr/lib/python2.7/dist-packages/gdata/service.pyc in PostOrPut(self, verb, data, uri, extra_headers, url_params, escape_params, redirects_remaining, media_source, converter)
   1300       server_response = self.request(verb, uri,
   1301           data=[multipart[0], data_str, multipart[1], media_source.file_handle,
-> 1302               multipart[2]], headers=extra_headers, url_params=url_params)
   1303       result_body = server_response.read()
   1304

/usr/lib/python2.7/dist-packages/atom/__init__.pyc in optional_warn_function(*args, **kwargs)
     90       if ENABLE_V1_WARNINGS:
     91         warnings.warn(warning, DeprecationWarning, stacklevel=2)
---> 92       return f(*args, **kwargs)
     93     # Preserve the original name to avoid masking all decorated functions as
     94     # 'deprecated_function'

/usr/lib/python2.7/dist-packages/atom/service.pyc in request(self, operation, url, data, headers, url_params)
    183       auth_token = self.token_store.find_token(url)
    184     return auth_token.perform_request(self.http_client, operation, url,
--> 185         data=data, headers=all_headers)
    186
    187   request = atom.v1_deprecated(

/usr/lib/python2.7/dist-packages/atom/http_interface.pyc in perform_request(self, http_client, operation, url, data, headers)
    146                       headers=None):
    147     """For the GenericToken, no Authorization token is set."""
--> 148     return http_client.request(operation, url, data=data, headers=headers)
    149
    150   def valid_for_scope(self, url):

/usr/lib/python2.7/dist-packages/atom/http.pyc in request(self, operation, url, data, headers)
    167       if isinstance(data, list):
    168         for data_part in data:
--> 169           _send_data_part(data_part, connection)
    170       else:
    171         _send_data_part(data, connection)

/usr/lib/python2.7/dist-packages/atom/http.pyc in _send_data_part(data, connection)
    353       binarydata = data.read(100000)
    354       if binarydata == '': break
--> 355       connection.send(binarydata)
    356     return
    357   else:

/usr/lib/python2.7/httplib.pyc in send(self, data)
    853                 datablock = data.read(blocksize)
    854         else:
--> 855             self.sock.sendall(data)
    856
    857     def _output(self, s):

/usr/lib/python2.7/ssl.pyc in sendall(self, data, flags)
    699             count = 0
    700             while (count < amount):
--> 701                 v = self.send(data[count:])
    702                 count += v
    703             return amount

/usr/lib/python2.7/ssl.pyc in send(self, data, flags)
    665                     self.__class__)
    666             try:
--> 667                 v = self._sslobj.write(data)
    668             except SSLError as x:
    669                 if x.args[0] == SSL_ERROR_WANT_READ:

error: [Errno 32] Broken pipe
khurshid-alam commented 6 years ago

Same issue here. Something wrong in openssl libraries.