无法使python模块ezsheets工作

时间:2020-05-27 11:36:17

标签: python

我遵循了ezsheets官方文档中的步骤。两个API均已激活(表格和驱动器),我打开了python shell并导入了ezsheets模块。但是,它没有像文档中所说的那样打开新的浏览器窗口。然后,我尝试并成功地使Google工作表与Google的快速入门脚本一起使用。我在与python脚本相同的文件夹中拥有凭据-sheets.json和token.pickle。 Sheets api本身似乎可以正常工作,但是当我使用ezsheets模块尝试时,出现以下错误:

 Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/ezsheets/__init__.py", line 1559, in listSpreadsheets
    if not IS_INITIALIZED: init()
  File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/ezsheets/__init__.py", line 1520, in init
    creds = flow.run_local_server()
  File "/home/method/.local/share/virtualenvs/python_projects-sgt8dc05/lib/python3.6/site-packages/google_auth_oauthlib/flow.py", line 443, in run_local_server
    host, port, wsgi_app, handler_class=_WSGIRequestHandler)
  File "/usr/lib/python3.6/wsgiref/simple_server.py", line 153, in make_server
    server = server_class((host, port), handler_class)
  File "/usr/lib/python3.6/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/usr/lib/python3.6/wsgiref/simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "/usr/lib/python3.6/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib/python3.6/socketserver.py", line 470, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

1 个答案:

答案 0 :(得分:0)

ezsheets试图打开端口8000上的Web服务器以获得访问令牌。但是它已经被另一个应用程序占用了。
检查哪个应用程序在端口8000上侦听并关闭它。

在Linux上,您可以使用

进行检查
netstat -tulpn | grep 8000

在Windows上:

netstat -ab