问题描述
我正在测试学习 Apache Thrift 的简单程度,它看起来很有希望.一个主要问题:第一个教程不起作用...
I am testing out how simple Apache Thrift is to learn and it looks promising. One major problem: the first tutorial doesn't work...
我有 Windows 7、Python 2.7,并获得了适用于 Windows v.0.9.1 的 Thrift .exe.我宁愿不从源代码编译,因为我不使用 Cygwin 等. exe 给出了下面描述的问题.所以我继续尝试使用 Chocolatey 来安装 Thrift辛斯特节俭效果很好,给了我 Thrift v0.9.0.但此版本的行为与 exe 相同,如下所述.
I have Windows 7, Python 2.7, and got the Thrift .exe for Windows v.0.9.1. I'd rather not compile from source as I don't use Cygwin etc. The exe gave the problems described below. So I moved on and tried using Chocolatey to install Thrift using cinst Thriftwhich worked fine and gave me Thrift v0.9.0. But this version results in the same behavior as the exe, described below.
当我运行在 http://thrift.apache.org/tutorial/py 上找到的教程时a> 我得到以下信息:
When I run the tutorial found at http://thrift.apache.org/tutorial/py I get the following:
C:\Users\Me\Desktop\Thrift>thrift -r --gen py tutorial.thrift
[WARNING:C:/Users/Me/Desktop/Thrift/tutorial.thrift:59] Could not find include file shared.thrift
[ERROR:C:/Users/Me/Desktop/Thrift/tutorial.thrift:123] (last token was 'shared.SharedService')
Service "shared.SharedService" has not been defined.
希望 exe 对某人有用,因为我很想避免这种需要从源代码构建的情况.
Hopefully the exe works for someone because I'd love to avoid this requiring a build from source.
推荐答案
答案是本教程假设您有一个/tutorial 文件夹,其中包含两个 .thrift 文件.如果您使用 Windows EXE 路径,然后构建您的 tutorial.thrift 文件,您将还需要添加 shared.thrift,它可以在 Git 中的 https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/shared.thrift
The answer is that the tutorial assumes you have a /tutorial folder with two .thrift files included in it. If you go the Windows EXE route and then build your tutorial.thrift file, you will also need to add shared.thrift which can be found in Git at https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob_plain;f=tutorial/shared.thrift
将此文件保存在您的 tutorial.thrift 文件旁边,您就可以继续学习本教程了.
Save this file next to your tutorial.thrift file and you can proceed with the tutorial.
这篇关于Windows 和 Apache Thrift 可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!