子进程的管道似乎坏了!无输出读取

Pipe to subprocess seems to be broken! No output read

我是 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')

相关行缺少缩进。

Python 中的缩进表示函数开始和结束的位置

Python functions have no explicit begin or end, and no curly braces to mark where the function code starts and stops. The only delimiter is a colon (:) and the indentation of the code itself.

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