管道到子进程似乎被打破了!没有输出读取

时间:2017-01-21 14:18:09

标签: python apache-storm

我是pythonstorm的新手,我试图让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')

1 个答案:

答案 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')