Skip to main content
 首页 » 编程设计

python之Ubuntu 18.04 LTS 上的 EOFError 错误 Apache Thrift

2024年12月31日35傻小

我正在阅读 Krzysztof Rakowski 的 Learning Apache Thrift 一书。在第 3 章(找到 [here])中,他解释了如何使用 python runserver.py 命令用 python 执行服务器。我执行该命令并在另一个终端中使用 python client.py 执行客户端。

在服务器端我看到这个输出:

Starting server on port 8081... 
127.0.0.1 - - [12/Sep/2018 04:32:38] code 403, message CGI script is not executable ('//MyFirstServer.php') 
127.0.0.1 - - [12/Sep/2018 04:32:38] "POST MyFirstServer.php HTTP/1.1" 403 - 
127.0.0.1 - - [12/Sep/2018 04:32:38] code 403, message CGI script is not executable ('//MyFirstServer.php') 
127.0.0.1 - - [12/Sep/2018 04:32:38] "POST MyFirstServer.php HTTP/1.1" 403 - 

在客户端我看到这个输出:

martinez@VM:~/Development$ python client.py 
logged current time to logfile (not waiting for response) 
Traceback (most recent call last): 
  File "client.py", line 31, in <module> 
    product = client.multiply(number1,number2) 
  File "gen-py/myfirst/MyFirstService.py", line 74, in multiply 
    return self.recv_multiply() 
  File "gen-py/myfirst/MyFirstService.py", line 87, in recv_multiply 
    (fname, mtype, rseqid) = iprot.readMessageBegin() 
  File "thrift-0.11.0/lib/py/build/lib.linux-x86_64-2.7/thrift/protocol/TBinaryProtocol.py", line 148, in readMessageBegin 
    name = self.trans.readAll(sz) 
  File "thrift-0.11.0/lib/py/build/lib.linux-x86_64-2.7/thrift/transport/TTransport.py", line 66, in readAll 
    raise EOFError() 
EOFError 

我试图解决这个问题

  1. 重新安装 thrift
  2. 从 Ubuntu 中删除了 Php 7 并安装了 php 版本 5。
  3. 检查了所有文件以确保我从端口 8080 切换到端口 8181。
  4. 检查所有文件以确保目录路径与正确版本的 thrift 相对应。

我该如何解决这个问题?还有,是什么原因造成的?

请您参考如下方法:

code 403, message CGI script is not executable 向我提示权限问题,可以通过 chmod +x MyFirstServer.php 修复。