2012-05-31
thrift tutorial中执行python的PythonServer.py,遇到如下错误:
[zhouhh@Hadoop48 py]$ python PythonServer.py
Starting the server...
Traceback (most recent call last):
File "PythonServer.py", line 95, in <module>
server.serve()
File "build/bdist.linux-x86_64/egg/thrift/server/TServer.py", line 74, in serve
File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 136, in listen
File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 31, in _resolveAddr
TypeError: getaddrinfo() argument 1 must be string or None
我们看一下File “PythonServer.py”, line 95,是这句
transport = TSocket.TServerSocket(9090)
我们看TserverSocket源码,[root@Hadoop48 py]# vim build/lib.linux-x86_64-2.7/thrift/transport/TSocket.py
def __init__(self, host=None, port=9090, unix_socket=None):
这是因为其初始化函数,第一个参数是host,第二个参数是port,所以想省去host,只填port是不行的。
将File “PythonServer.py”, line 95改为:
transport = TSocket.TServerSocket('localhost',9090)
或者改为:
transport = TSocket.TServerSocket(port=9090)
即可解决该问题。
如非注明转载, 均为原创. 本站遵循知识共享CC协议,转载请注明来源
FEATURED TAGS
css
vc6
http
automake
linux
make
makefile
voip
乱码
awk
flash
vista
vi
vim
javascript
pietty
putty
ssh
posix
subversion
svn
windows
删除
编译
多线程
wxwidgets
ie
ubuntu
开源
c
python
bash
备份
性能
scp
汉字
log
ruby
中文
bug
msn
nginx
php
shell
wordpress
mqueue
android
eclipse
java
mac
ios
html5
js
mysql
protobuf
apache
hadoop
install
iocp
twisted
centos
mapreduce
hbase
thrift
tutorial
hive
erlang
lucene
hdfs
sqoop
utf8
filter
草原
yarn
ganglia
恢复
scrapy
django
fsimage
flume
tail
flume-ng
mining
scala
go
kafka
gradle
cassandra
baas
spring
postgres
maven
mybatis
mongodb
https
nodejs
镜像
心理学
机器学习
Keras
theano
anaconda
docker
spark
akka-http
json
群论
区块链
加密
抽象代数
离散对数
同余
欧拉函数
扩展欧几里德算法
ES6
node-inspect
debug
win10
vscode
挖矿