0

I wrote a code to upload (create and update) a file to google drive, in Windows 10 with python 3.9 it work, but in windows 2008 server with python 3.8 it give me an error.

just to remember 3.8 is the max version that supports windows 2008

if I try to list from gdrive it work, the problem is just to create or update the file. just to remember 3.8 is the last python version that supports windows 2008. I suspect its related with windows 2008 and ssl maybe!?!?

the error is this:

C:\backupmgr>python drive.py
Traceback (most recent call last):
  File "drive.py", line 112, in <module>
    envia_zip('sexta.7z')
  File "drive.py", line 104, in envia_zip
    file = service.files().create(body=file_metadata, media_body=media).execute(
)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\googleapiclient\_helpers.py", line 130, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\googleapiclient\http.py", line 923, in execute
    resp, content = _retry_request(
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\googleapiclient\http.py", line 222, in _retry_request
    raise exception
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\googleapiclient\http.py", line 191, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\google_auth_httplib2.py", line 218, in request
    response, content = self.http.request(
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\httplib2\__init__.py", line 1720, in request
    (response, content) = self._request(
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\httplib2\__init__.py", line 1440, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, he
aders)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\site-p
ackages\httplib2\__init__.py", line 1363, in _conn_request
    conn.request(method, request_uri, body, headers)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\http\c
lient.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\http\c
lient.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\http\c
lient.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\http\c
lient.py", line 1046, in _send_output
    self.send(chunk)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\http\c
lient.py", line 968, in send
    self.sock.sendall(data)
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\ssl.py
", line 1204, in sendall
    v = self.send(byte_view[count:])
  File "C:\Users\Administrador\AppData\Local\Programs\Python\Python38\lib\ssl.py
", line 1173, in send
    return self._sslobj.write(data)
socket.timeout: The write operation timed out

4
  • Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible example. Commented Dec 16, 2022 at 19:09
  • the error occurs on file = service.files().create(body=file_metadata, media_body=media).execute() trying breaking each step down and trying it individually? to see clearly where the error is coming from because that single lin has multiple dot operators so it is unclear where the error in that line is occuing. Commented Dec 16, 2022 at 23:11
  • Please provide enough code so others can better understand or reproduce the problem. Commented Dec 16, 2022 at 23:11
  • 1
    Curious. The library supports Only python 3.7 and newer is supported. so with 3.8 you should be good. Sounds like a networking error to me found this #632 and this 1080 Commented Dec 17, 2022 at 9:31

1 Answer 1

1

Well it works now, as @DaImTo poited to the issue #632 in the google api github, it is not a problem with the api. The problem is that the socket core module has low default timeout. The pc with windows server 2008 that I was using was very slow and was hiting this default timeout, so I just had rise the default timeout by inserting the code in the beginin of the script:

import socket
socket.setdefaulttimeout(600)
Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.