如何在Github上找到错误消息?

时间:2016-03-31 17:36:49

标签: python github

对于我正在使用的python脚本,我收到了这个错误:

Traceback (most recent call last):
  File "label2.py", line 52, in <module>
    main(args.image_file)
  File "label2.py", line 40, in main
    response = service_request.execute()
  File "C:\Program Files\Python35-32\lib\site-packages\oauth2client\util.py", line 137, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\Program Files\Python35-32\lib\site-packages\googleapiclient\http.py", line 755, in execute
    method=str(self.method), body=self.body, headers=self.headers)
  File "C:\Program Files\Python35-32\lib\site-packages\googleapiclient\http.py", line 93, in _retry_request
    resp, content = http.request(uri, method, *args, **kwargs)
  File "C:\Program Files\Python35-32\lib\site-packages\oauth2client\client.py", line 598, in new_request
    self._refresh(request_orig)
  File "C:\Program Files\Python35-32\lib\site-packages\oauth2client\client.py", line 864, in _refresh
    self._do_refresh_request(http_request)
  File "C:\Program Files\Python35-32\lib\site-packages\oauth2client\client.py", line 933, in _do_refresh_request
    raise HttpAccessTokenRefreshError(error_msg, status=resp.status)
oauth2client.client.HttpAccessTokenRefreshError: invalid_scope: Empty or missing scope not allowed.

我在Github检查了源代码:https://github.com/google/oauth2client/blob/master/oauth2client/client.py但找不到错误消息“空闲或遗漏范围不允许。”

是否有一种方法可以在Github上找到与错误跟踪相对应的错误消息?我看错了文件吗?我应该在哪里看?

(这是'教我如何钓鱼'而不是'给我一条鱼'的问题。)

1 个答案:

答案 0 :(得分:3)

如果查看生成该消息的代码(oauth2client/client.py中的第933行),您可以看到该消息来自服务器的http响应。这是{{1}的一部分方法,以:

开头
_do_refresh_request

后来设定:

      resp, content = http_request(
          self.token_uri, method='POST', body=body, headers=headers)

在例外中使用的是:

          error_msg = 'Invalid response %s.' % resp['status']

换句话说,您无法在源中找到错误消息的原因是因为它不存在于源中;它是由oauth服务器生成的错误,作为http响应的一部分传递给您的客户端。