QGIS - AttributeError: 'NoneType' object has no attribute 'name'

hello i have a python problem when i try to start a plugin on QGIS. The plugin uses wms and raster (orthophoto) backgrounds.

    def get_data_source_file_path(layer):
    # get source path
    provider = layer.dataProvider().name()
    source_parts = QgsProviderRegistry.instance().decodeUri(provider, layer.source() )
    source_path = source_parts.get( 'path', '' )
    if 'ogr' == provider.lower():
        source_path = source_path.split('|')[0]
    return path.normpath( source_path )

'NoneType' object has no attribute 'name'

can anyone help me?

Upvotes: -3

Views: 27

Answers (0)

Related Questions