Oserror: [Errno 9] Bad file Descriptor when running the Google API build

Asked

Viewed 24 times

-1

Hello!

I followed the doc to make the connection of google Sheets and google drive via script, using the python language and was working normally. Today, began to present an error when I run the line service = build('drive', 'v3', credentials=creds)

Error message:


/usr/local/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    132                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 
    136         return positional_wrapper

/usr/local/lib/python3.7/site-packages/googleapiclient/discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options, adc_cert_path, adc_key_path, num_retries)
    268             content = _retrieve_discovery_doc(
    269                 requested_url, discovery_http, cache_discovery, cache,
--> 270                 developerKey, num_retries=num_retries
    271             )
    272             return build_from_document(

/usr/local/lib/python3.7/site-packages/googleapiclient/discovery.py in _retrieve_discovery_doc(url, http, cache_discovery, cache, developerKey, num_retries)
    357     # Note that it will already raise an error if we don't get a 2xx response
    358     req = HttpRequest(http, HttpRequest.null_postproc, actual_url)
--> 359     resp, content = req.execute(num_retries=num_retries)
    360 
    361     try:

/usr/local/lib/python3.7/site-packages/googleapiclient/_helpers.py in positional_wrapper(*args, **kwargs)
    132                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 
    136         return positional_wrapper

/usr/local/lib/python3.7/site-packages/googleapiclient/http.py in execute(self, http, num_retries)
    899             method=str(self.method),
    900             body=self.body,
--> 901             headers=self.headers,
    902         )
    903 

/usr/local/lib/python3.7/site-packages/googleapiclient/http.py in _retry_request(http, num_retries, req_type, sleep, rand, uri, method, *args, **kwargs)
    175         try:
    176             exception = None
--> 177             resp, content = http.request(uri, method, *args, **kwargs)
    178         # Retry on SSL errors and socket timeout errors.
    179         except _ssl_SSLError as ssl_error:

/usr/local/lib/python3.7/site-packages/httplib2/__init__.py in request(self, uri, method, body, headers, redirections, connection_type)
   1320                     content = b""
   1321                 else:
-> 1322                     (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
   1323         except Exception as e:
   1324             if self.force_exception_to_status_code:

/usr/local/lib/python3.7/site-packages/httplib2/__init__.py in _request(self, conn, host, absolute_uri, request_uri, method, body, headers, redirections, cachekey)
   1070             auth.request(method, request_uri, headers, body)
   1071 
-> 1072         (response, content) = self._conn_request(conn, request_uri, method, body, headers)
   1073 
   1074         if auth:

/usr/local/lib/python3.7/site-packages/httplib2/__init__.py in _conn_request(self, conn, request_uri, method, body, headers)
    994                 if conn.sock is None:
    995                     conn.connect()
--> 996                 conn.request(method, request_uri, body, headers)
    997             except socket.timeout:
    998                 conn.close()

/usr/local/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1279                 encode_chunked=False):
   1280         """Send a complete request to the server."""
-> 1281         self._send_request(method, url, body, headers, encode_chunked)
   1282 
   1283     def _send_request(self, method, url, body, headers, encode_chunked):

/usr/local/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1325             # default charset of iso-8859-1.
   1326             body = _encode(body, 'body')
-> 1327         self.endheaders(body, encode_chunked=encode_chunked)
   1328 
   1329     def getresponse(self):

/usr/local/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
   1274         else:
   1275             raise CannotSendHeader()
-> 1276         self._send_output(message_body, encode_chunked=encode_chunked)
   1277 
   1278     def request(self, method, url, body=None, headers={}, *,

/usr/local/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
   1034         msg = b"\r\n".join(self._buffer)
   1035         del self._buffer[:]
-> 1036         self.send(msg)
   1037 
   1038         if message_body is not None:

/usr/local/lib/python3.7/http/client.py in send(self, data)
    995             return
    996         try:
--> 997             self.sock.sendall(data)
    998         except TypeError:
    999             if isinstance(data, collections.abc.Iterable):

OSError: [Errno 9] Bad file descriptor

Please, someone would know how to fix?

Grateful!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.