TransWikia.com

Atlas export using Python: AttributeError: 'NoneType' object has no attribute 'atlas'

Geographic Information Systems Asked on August 28, 2021

I’m trying to export my atlas layout named “Atlas_png”, but are getting the error:

AttributeError: 'NoneType' object has no attribute 'atlas' (line 27).

I have tried to use this examples:
Exporting QGIS Atlas using PyQGIS (qgis.core) —- Error line 27:

# Open prepared layout that as atlas enabled and set
layout = project.layoutManager().layoutByName(layout_name)

# Export atlas
exporter = QgsLayoutExporter(layout)
settings = QgsLayoutExporter.ImageExportSettings()
exporter.exportToImage(layout.atlas(),output_folder, 'png', settings) 

https://github.com/carey136/Standalone-Export-Atlas-QGIS3 —- Error line 85:

QgsProject.instance().read(myProject)
myLayout = QgsProject.instance().layoutManager().layoutByName(layoutName)
myAtlas = myLayout.atlas()
myAtlasMap = myAtlas.layout()

I am sure that there is a layout called “Atlas_png” in the qgs project. I can get the name when running printLayouts in the Python console directly in QGIS.

Every examples seems to work, except when I am running them.

Any leads?

Running Python 3.7.0 and QGIS 3.10.2

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP