2013-07-27 247 views
-2

我有下面的代碼:NoneType」對象有沒有屬性‘分裂’

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()) 
+2

'pipeline'是在方法調用 – jozefg

+0

期間無有是沒有錯的代碼,從那裏你打了嗎? – filmor

+1

這個方法裏面的'print repr(pipeline)'*方法告訴你什麼? –

回答

1

pipelineNone。如果你想找出原因,可以像這樣改變線條並使用調試器來查明。

try: 
    pipeline = " ".join(pipeline.split()) 
except: 
    import pdb;pdb.set_trace() 
相關問題