我是python
和storm
的新手,我试图让spout
逐行读取我的数据文本文件但是出现了此错误
ERROR backtype.storm.util - Async loop died!
java.lang.RuntimeException: backtype.storm.multilang.NoOutputException: Pipe to subprocess seems to be broken! No output read.
Serializer Exception:
File "mspout.py", line 9
f = open('data.txt', 'r')
^
IndentationError: expected an indented block
代码是
def initialize(self, conf, context):
## Open the file with read only permit
f = open('data.txt', 'r')
答案 0 :(得分:0)
有问题的行缺少缩进。
Python中的缩进表示函数的开始和结束位置
Python函数没有明确的开头或结尾,也没有花括号来标记功能代码的开始和停止位置。唯一的分隔符是冒号(:)和代码本身的缩进。
http://www.diveintopython.net/getting_to_know_python/indenting_code.html
def initialize(self, conf, context):
## Open the file with read only permit
f = open('data.txt', 'r')