-2

我有以下代码:

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以检查它是否为无,但事实并非如此。

这条线有什么问题?

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

1 回答 1

1

pipeline None。如果您想找出原因,请像这样更改行并使用调试器找出原因。

try:
    pipeline = " ".join(pipeline.split())
except:
    import pdb;pdb.set_trace()
于 2013-07-27T13:48:44.903 回答