Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to open gee after entering verification code #92

Closed
ChaiChenhao opened this issue Jun 3, 2020 · 1 comment
Closed

Failed to open gee after entering verification code #92

ChaiChenhao opened this issue Jun 3, 2020 · 1 comment

Comments

@ChaiChenhao
Copy link

  • geemap version:0.6.10
  • Python version:3.8.3
  • Operating System:Windows 10

Description

After I input the Google verification code, I did not open the Google Earth engine interface, and there were many error prompts.

What I Did

**FileNotFoundError**                         
Traceback (most recent call last)
E:\anaconda\envs\gee\lib\site-packages\ee\data.py in get_persistent_credentials()
229   try:
230     tokens = json.load(open(oauth.get_credentials_path()))
231     refresh_token = tokens['refresh_token']

FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Administrator/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

EEException                               Traceback (most recent call last)
E:\anaconda\envs\gee\lib\site-packages\geemap\geemap.py in ee_initialize()
 24     try:
 25         ee.Initialize()
 26     except Exception as e:
E:\anaconda\envs\gee\lib\site-packages\ee\__init__.py in Initialize(credentials, opt_url, use_cloud_api, cloud_api_key, http_transport, project)
 113   if credentials == 'persistent':
 114     credentials = data.get_persistent_credentials()
 115   data.initialize(E:\anaconda\envs\gee\lib\site-packages\ee\data.py in get_persistent_credentials()
239   except IOError:
240     raise ee_exception.EEException(
241     'Please authorize access to your Earth Engine account by '
EEException: Please authorize access to your Earth Engine account by running
earthengine authenticate in your command line, and then retry.
During handling of the above exception, another exception occurred:

TimeoutError                              
Traceback (most recent call last)
E:\anaconda\envs\gee\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1349     try:
1350             h.request(req.get_method(), req.selector, req.data, headers,
1351              encode_chunked=req.has_header('Transfer-encoding'))

E:\anaconda\envs\gee\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1239         """Send a complete request to the server."""
1240         self._send_request(method, url, body, headers, encode_chunked)
 1241 

E:\anaconda\envs\gee\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1285             body = _encode(body, 'body')
1286         self.endheaders(body, encode_chunked=encode_chunked)
 1287 
E:\anaconda\envs\gee\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1234             raise CannotSendHeader()
1235         self._send_output(message_body, encode_chunked=encode_chunked)
1236 

E:\anaconda\envs\gee\lib\http\client.py in _send_output(self, message_body, encode_chunked)
   1005         del self._buffer[:]
-> 1006         self.send(msg)
   1007 

E:\anaconda\envs\gee\lib\http\client.py in send(self, data)
    945             if self.auto_open:
--> 946                 self.connect()
    947             else:

E:\anaconda\envs\gee\lib\http\client.py in connect(self)
   1401 
-> 1402             super().connect()
   1403 

E:\anaconda\envs\gee\lib\http\client.py in connect(self)
    916         """Connect to the host and port specified in __init__."""
--> 917         self.sock = self._create_connection(
    918             (self.host,self.port), self.timeout, self.source_address)

E:\anaconda\envs\gee\lib\socket.py in create_connection(address, timeout, source_address)
    807         try:
--> 808             raise err
    809         finally:

E:\anaconda\envs\gee\lib\socket.py in create_connection(address, timeout, source_address)
    795                 sock.bind(source_address)
--> 796             sock.connect(sa)
    797             # Break explicitly a reference cycle

TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-3-ef5c07d70876> in <module>
----> 1 m = geemap.Map()
      2 m

E:\anaconda\envs\gee\lib\site-packages\geemap\geemap.py in __init__(self, **kwargs)
     42 
     43         # Authenticates Earth Engine and initializes an Earth Engine session
---> 44         ee_initialize()
     45 
     46         # Default map center location and zoom level

E:\anaconda\envs\gee\lib\site-packages\geemap\geemap.py in ee_initialize()
     25         ee.Initialize()
     26     except Exception as e:
---> 27         ee.Authenticate()
     28         ee.Initialize()
     29 

E:\anaconda\envs\gee\lib\site-packages\ee\__init__.py in Authenticate(authorization_code, quiet, code_verifier)
     84     code_verifier: PKCE verifier to prevent auth code stealing.
     85   """
---> 86   oauth.authenticate(authorization_code, quiet, code_verifier)
     87 
     88 

E:\anaconda\envs\gee\lib\site-packages\ee\oauth.py in authenticate(cli_authorization_code, quiet, cli_code_verifier)
    231   webbrowser.open_new(auth_url)
    232 
--> 233   _obtain_and_write_token(None, code_verifier)  # Will prompt for auth_code.

E:\anaconda\envs\gee\lib\site-packages\ee\oauth.py in _obtain_and_write_token(auth_code, code_verifier)
    137     auth_code = input('Enter verification code: ')
    138   assert isinstance(auth_code, six.string_types)
--> 139   token = request_token(auth_code.strip(), code_verifier)
    140   write_token(token)
    141   print('\nSuccessfully saved authorization token.')

E:\anaconda\envs\gee\lib\site-packages\ee\oauth.py in request_token(auth_code, code_verifier)
     80 
     81   try:
---> 82     response = request.urlopen(
     83         TOKEN_URI,
     84         parse.urlencode(request_args).encode()).read().decode()

E:\anaconda\envs\gee\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    220     else:
    221         opener = _opener
--> 222     return opener.open(url, data, timeout)
    223 
    224 def install_opener(opener):

E:\anaconda\envs\gee\lib\urllib\request.py in open(self, fullurl, data, timeout)
    523 
    524         sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 525         response = self._open(req, data)
    526 
    527         # post-process response

E:\anaconda\envs\gee\lib\urllib\request.py in _open(self, req, data)
    540 
    541         protocol = req.type
--> 542         result = self._call_chain(self.handle_open, protocol, protocol +
    543                                   '_open', req)
    544         if result:

E:\anaconda\envs\gee\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
    500         for handler in handlers:
    501             func = getattr(handler, meth_name)
--> 502             result = func(*args)
    503             if result is not None:
    504                 return result

E:\anaconda\envs\gee\lib\urllib\request.py in https_open(self, req)
   1391 
   1392         def https_open(self, req):
-> 1393             return self.do_open(http.client.HTTPSConnection, req,
   1394                 context=self._context, check_hostname=self._check_hostname)
   1395 

E:\anaconda\envs\gee\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
   1351                           encode_chunked=req.has_header('Transfer-encoding'))
   1352             except OSError as err: # timeout error
-> 1353                 raise URLError(err)
   1354             r = h.getresponse()
   1355         except:

URLError: <urlopen error [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。>
@giswqs
Copy link
Member

giswqs commented Jun 3, 2020

This is not a geemap issue. It is the Google Earth Engine access issue in China. I don't have any solution for this. Check this to see if it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants