NoneType'对象没有属性'split'

时间:2013-07-27 13:35:31

标签: python

我有以下代码:

def parse_pipeline(self, pipeline):
    """

    Parse the pipeline template into a fully expanded pipeline string.

    @type  pipeline: str
    @rtype: str
    """
    pipeline = " ".join(pipeline.split())
    self.debug('Creating pipeline, template is %s', pipeline)

    if pipeline == '' and not self.eaters:
        raise TypeError("Need a pipeline or a eater")

    if pipeline == '':
        # code of dubious value
        assert self.eaters
        pipeline = 'fakesink signal-handoffs=1 silent=1 name=sink'

    pipeline = self.add_default_eater_feeder(pipeline)
    pipeline = self.parse_tmpl(pipeline,
                               {'eater:': self.get_eater_template,
                                'feeder:': self.get_feeder_template})

    self.debug('pipeline is %s', pipeline)
    assert self.DELIMITER not in pipeline

    return pipeline

当它运行时,我得到:

Setup failed: failure <type 'exceptions.AttributeError'> at
flumotion/component/feedcomponent.py:443: parse_pipeline():
     'NoneType' object has no attribute 'split' (flumotion/component/component.py:586)

我尝试打印pipeline来检查它是否为None,但事实并非如此。

这条线有什么问题?

pipeline = " ".join(pipeline.split())

1 个答案:

答案 0 :(得分:1)

pipeline None。如果你想找出原因,可以改变这样的行并使用调试器来查找。

try:
    pipeline = " ".join(pipeline.split())
except:
    import pdb;pdb.set_trace()