[{"data":1,"prerenderedAt":1856},["ShallowReactive",2],{"doc:\u002Fpyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002Fopen-project-with-read-flags-pyqgis":3},{"id":4,"title":5,"body":6,"description":1845,"extension":1846,"meta":1847,"navigation":205,"path":1852,"seo":1853,"stem":1854,"__hash__":1855},"docs\u002Fpyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002Fopen-project-with-read-flags-pyqgis\u002Findex.md","Open a Project with Read Flags in PyQGIS",{"type":7,"value":8,"toc":1831},"minimark",[9,13,22,31,131,136,155,159,164,333,358,362,365,429,437,441,444,808,825,829,832,1008,1016,1020,1031,1294,1306,1310,1313,1396,1661,1673,1677,1699,1703,1735,1739,1745,1749,1755,1765,1771,1777,1787,1793,1797,1827],[10,11,5],"h1",{"id":12},"open-a-project-with-read-flags-in-pyqgis",[14,15,16,17,21],"p",{},"Opening a project in a script does more work than most scripts need. QGIS validates every layer's data source, reads extents and feature counts, loads every print layout, and pops up a dialog for missing files — fine for a person at the desk, slow or blocking for a script that only wants to list layers, change a path or export one layout. Read flags tell ",[18,19,20],"code",{},"QgsProject.read"," what to skip, and a custom bad-layer handler replaces the dialog with code, so scripts open projects quickly and never hang waiting for a click.",[14,23,24,25,30],{},"This recipe belongs to ",[26,27,29],"a",{"href":28},"\u002Fpyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002F","Working with QGIS Projects",". It opens projects with flags that skip layouts and data checks, trusts stored layer metadata, handles missing layers in code, inspects project files without loading data, and processes many projects in a batch.",[14,32,33],{},[34,35,40,44,48,55,64,74,80,85,90,95,99,103,108,112,115,121,125,128],"svg",{"viewBox":36,"role":37,"ariaLabel":38,"xmlns":39},"0 0 760 262","img","The steps of a normal project read and which ones read flags can skip or replace","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg",[41,42,43],"title",{},"What reading a project normally does",[45,46,47],"desc",{},"A normal project read parses the project file, opens every layer's data source to check it, reads extents and statistics, loads every print layout with its items, and shows a dialog for layers whose data is missing. Read flags can skip loading layouts, avoid opening data sources by trusting stored metadata, and skip loading layers entirely, and a bad layer handler replaces the dialog.",[49,50],"rect",{"x":51,"y":51,"width":52,"height":53,"fill":54},"0","760","262","#f6f3ea",[56,57,63],"text",{"x":58,"y":59,"style":60,"fill":61,"textAnchor":62},"380","28","text-anchor:middle;font-size:14px;font-family:sans-serif;font-weight:bold","#17211d","middle","Each step can be skipped or replaced",[49,65],{"x":66,"y":67,"width":68,"height":69,"rx":70,"fill":71,"stroke":72,"style":73},"24","56","168","190","8","#fffdf7","#59645f","stroke-width:2",[56,75,79],{"x":76,"y":77,"style":78,"fill":61,"textAnchor":62},"108","140.78","text-anchor:middle;font-size:11.5px;font-family:sans-serif;font-weight:bold","parse file",[56,81,84],{"x":76,"y":82,"style":83,"fill":72,"textAnchor":62},"168.78","text-anchor:middle;font-size:10.5px;font-family:sans-serif","always",[49,86],{"x":87,"y":67,"width":68,"height":69,"rx":70,"fill":88,"stroke":89,"style":73},"206","#eef7f4","#0f766e",[56,91,94],{"x":92,"y":93,"style":78,"fill":89,"textAnchor":62},"290","126.78","open sources",[56,96,98],{"x":92,"y":97,"style":83,"fill":72,"textAnchor":62},"154.78","trust stored",[56,100,102],{"x":92,"y":101,"style":83,"fill":72,"textAnchor":62},"182.78","metadata",[49,104],{"x":105,"y":67,"width":68,"height":69,"rx":70,"fill":106,"stroke":107,"style":73},"388","#eff3ff","#2563eb",[56,109,111],{"x":110,"y":77,"style":78,"fill":107,"textAnchor":62},"472","load layouts",[56,113,114],{"x":110,"y":82,"style":83,"fill":72,"textAnchor":62},"DontLoadLayouts",[49,116],{"x":117,"y":67,"width":118,"height":69,"rx":70,"fill":119,"stroke":120,"style":73},"570","166","#fdf2e2","#b45309",[56,122,124],{"x":123,"y":93,"style":78,"fill":120,"textAnchor":62},"653","missing data",[56,126,127],{"x":123,"y":97,"style":83,"fill":72,"textAnchor":62},"dialog →",[56,129,130],{"x":123,"y":101,"style":83,"fill":72,"textAnchor":62},"your handler",[132,133,135],"h2",{"id":134},"prerequisites","Prerequisites",[137,138,139,143],"ul",{},[140,141,142],"li",{},"QGIS 3.34 LTR or newer, or the QGIS 4 series.",[140,144,145,146,149,150,154],{},"A standalone script with an initialised ",[18,147,148],{},"QgsApplication",", or the Python console, as described in ",[26,151,153],{"href":152},"\u002Fpyqgis-fundamentals-environment-setup\u002Fvirtual-environments-for-gis\u002Frunning-python-scripts-outside-qgis-desktop\u002F","running Python scripts outside QGIS Desktop",".",[132,156,158],{"id":157},"read-a-project-with-flags","Read a project with flags",[14,160,161,163],{},[18,162,20],{}," takes a path and a combination of read flags. The most useful for scripts skip layouts and avoid touching data sources.",[165,166,171],"pre",{"className":167,"code":168,"language":169,"meta":170,"style":170},"language-python shiki shiki-themes github-dark","import time\nfrom qgis.core import QgsProject, Qgis\n\nproject = QgsProject.instance()\nflags = (Qgis.ProjectReadFlag.DontLoadLayouts\n         | Qgis.ProjectReadFlag.TrustLayerMetadata\n         | Qgis.ProjectReadFlag.DontLoad3DViews)\n\nstart = time.perf_counter()\nok = project.read(\"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\", flags)\nprint(ok, f\"{time.perf_counter() - start:.2f} s,\", len(project.mapLayers()), \"layers\")\n","python","",[18,172,173,186,200,207,219,230,239,247,252,263,281],{"__ignoreMap":170},[174,175,178,182],"span",{"class":176,"line":177},"line",1,[174,179,181],{"class":180},"snl16","import",[174,183,185],{"class":184},"s95oV"," time\n",[174,187,189,192,195,197],{"class":176,"line":188},2,[174,190,191],{"class":180},"from",[174,193,194],{"class":184}," qgis.core ",[174,196,181],{"class":180},[174,198,199],{"class":184}," QgsProject, Qgis\n",[174,201,203],{"class":176,"line":202},3,[174,204,206],{"emptyLinePlaceholder":205},true,"\n",[174,208,210,213,216],{"class":176,"line":209},4,[174,211,212],{"class":184},"project ",[174,214,215],{"class":180},"=",[174,217,218],{"class":184}," QgsProject.instance()\n",[174,220,222,225,227],{"class":176,"line":221},5,[174,223,224],{"class":184},"flags ",[174,226,215],{"class":180},[174,228,229],{"class":184}," (Qgis.ProjectReadFlag.DontLoadLayouts\n",[174,231,233,236],{"class":176,"line":232},6,[174,234,235],{"class":180},"         |",[174,237,238],{"class":184}," Qgis.ProjectReadFlag.TrustLayerMetadata\n",[174,240,242,244],{"class":176,"line":241},7,[174,243,235],{"class":180},[174,245,246],{"class":184}," Qgis.ProjectReadFlag.DontLoad3DViews)\n",[174,248,250],{"class":176,"line":249},8,[174,251,206],{"emptyLinePlaceholder":205},[174,253,255,258,260],{"class":176,"line":254},9,[174,256,257],{"class":184},"start ",[174,259,215],{"class":180},[174,261,262],{"class":184}," time.perf_counter()\n",[174,264,266,269,271,274,278],{"class":176,"line":265},10,[174,267,268],{"class":184},"ok ",[174,270,215],{"class":180},[174,272,273],{"class":184}," project.read(",[174,275,277],{"class":276},"sU2Wk","\"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\"",[174,279,280],{"class":184},", flags)\n",[174,282,284,288,291,294,297,300,303,306,309,312,315,318,321,324,327,330],{"class":176,"line":283},11,[174,285,287],{"class":286},"sDLfK","print",[174,289,290],{"class":184},"(ok, ",[174,292,293],{"class":180},"f",[174,295,296],{"class":276},"\"",[174,298,299],{"class":286},"{",[174,301,302],{"class":184},"time.perf_counter() ",[174,304,305],{"class":180},"-",[174,307,308],{"class":184}," start",[174,310,311],{"class":180},":.2f",[174,313,314],{"class":286},"}",[174,316,317],{"class":276}," s,\"",[174,319,320],{"class":184},", ",[174,322,323],{"class":286},"len",[174,325,326],{"class":184},"(project.mapLayers()), ",[174,328,329],{"class":276},"\"layers\"",[174,331,332],{"class":184},")\n",[14,334,335,339,340,342,343,346,347,350,351,354,355,154],{},[336,337,338],"strong",{},"Breakdown:"," ",[18,341,114],{}," skips building print layouts, which in projects with many layouts and atlases can be the slowest part of opening. ",[18,344,345],{},"TrustLayerMetadata"," uses the extents and other metadata stored in the project instead of querying each data source — a large saving for PostGIS and web-service layers, where each check is a network round trip. ",[18,348,349],{},"DontLoad3DViews"," skips 3D map view configurations. On QGIS releases before 3.26 the flags live on ",[18,352,353],{},"QgsProject.ReadFlag"," instead of ",[18,356,357],{},"Qgis.ProjectReadFlag",[132,359,361],{"id":360},"choose-flags-for-the-job","Choose flags for the job",[14,363,364],{},"The right combination depends on what the script will do with the project.",[14,366,367],{},[34,368,371,374,377,380,383,386,391,397,401,403,406,408,410,412,415,417,420,422,425,427],{"viewBox":369,"role":37,"ariaLabel":370,"xmlns":39},"0 0 760 250","Recommended read flags for listing layers, analysis, layout export and inspection, with the trade-off of skipping too much",[41,372,373],{},"Flags by task",[45,375,376],{},"To list or edit layer paths and properties: DontResolveLayers keeps layers unloaded and is fastest. To render maps or run analysis without layouts: DontLoadLayouts plus TrustLayerMetadata. To export layouts: load layouts but trust metadata. To inspect styles or variables only: DontResolveLayers and DontLoadLayouts. Using too many flags breaks tasks that need the skipped parts.",[49,378],{"x":51,"y":51,"width":52,"height":379,"fill":54},"250",[56,381,382],{"x":58,"y":59,"style":60,"fill":61,"textAnchor":62},"Skip what the task does not need",[49,384],{"x":66,"y":67,"width":68,"height":385,"rx":70,"fill":88,"stroke":89,"style":73},"170",[56,387,390],{"x":76,"y":388,"style":389,"fill":89,"textAnchor":62},"116.6","text-anchor:middle;font-size:11.0px;font-family:sans-serif;font-weight:bold","edit paths",[56,392,396],{"x":76,"y":393,"style":394,"fill":395,"textAnchor":62},"144.6","text-anchor:middle;font-size:10.0px;font-family:sans-serif","#2f3b35","DontResolveLayers",[56,398,400],{"x":76,"y":399,"style":394,"fill":72,"textAnchor":62},"172.6","fastest",[49,402],{"x":87,"y":67,"width":68,"height":385,"rx":70,"fill":106,"stroke":107,"style":73},[56,404,405],{"x":92,"y":388,"style":389,"fill":107,"textAnchor":62},"analysis",[56,407,114],{"x":92,"y":393,"style":394,"fill":395,"textAnchor":62},[56,409,345],{"x":92,"y":399,"style":394,"fill":395,"textAnchor":62},[49,411],{"x":105,"y":67,"width":68,"height":385,"rx":70,"fill":119,"stroke":120,"style":73},[56,413,414],{"x":110,"y":388,"style":389,"fill":120,"textAnchor":62},"layout export",[56,416,345],{"x":110,"y":393,"style":394,"fill":395,"textAnchor":62},[56,418,419],{"x":110,"y":399,"style":394,"fill":72,"textAnchor":62},"layouts needed",[49,421],{"x":117,"y":67,"width":118,"height":385,"rx":70,"fill":71,"stroke":72,"style":73},[56,423,424],{"x":123,"y":388,"style":389,"fill":61,"textAnchor":62},"inspect only",[56,426,396],{"x":123,"y":393,"style":394,"fill":395,"textAnchor":62},[56,428,114],{"x":123,"y":399,"style":394,"fill":395,"textAnchor":62},[14,430,431,433,434,436],{},[18,432,396],{}," goes furthest: layers are created from their project definition but their data providers are not opened, so the layer objects exist with names, sources, styles and ids but cannot be drawn or queried. That is ideal for scripts that rewrite data source paths, audit styles or change variables and save. For analysis or rendering, layers must resolve, so use ",[18,435,345],{}," and skip layouts instead. A script that exports a layout obviously must load layouts.",[132,438,440],{"id":439},"handle-missing-layers-in-code","Handle missing layers in code",[14,442,443],{},"When a layer's data cannot be found, QGIS Desktop shows the \"Handle unavailable layers\" dialog. Scripts need a handler that decides without asking — log the problem, try a known relocation, or leave the layer invalid.",[165,445,447],{"className":167,"code":446,"language":169,"meta":170,"style":170},"from qgis.core import QgsProjectBadLayerHandler\nfrom pathlib import Path\n\nclass RelocatingHandler(QgsProjectBadLayerHandler):\n    def __init__(self, old_root, new_root):\n        super().__init__()\n        self.old_root, self.new_root = old_root, new_root\n        self.report = []\n\n    def handleBadLayers(self, layers):\n        for node in layers:\n            ds_elem = node.firstChildElement(\"datasource\")\n            source = ds_elem.text()\n            name = node.firstChildElement(\"layername\").text()\n            candidate = source.replace(self.old_root, self.new_root)\n            path_part = candidate.split(\"|\")[0]\n            if candidate != source and Path(path_part).exists():\n                ds_elem.firstChild().setNodeValue(candidate)\n                self.report.append((name, \"relocated\"))\n            else:\n                self.report.append((name, f\"missing: {source}\"))\n\nhandler = RelocatingHandler(\"\u002F\u002Foldserver\u002Fgis\", \"\u002Fmnt\u002Fgis\")\nproject.setBadLayerHandler(handler)\nproject.read(\"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\", Qgis.ProjectReadFlag.DontLoadLayouts)\nfor row in handler.report:\n    print(*row)\n",[18,448,449,460,472,476,494,505,519,538,550,554,564,578,594,605,621,641,663,684,690,705,714,737,742,763,769,780,794],{"__ignoreMap":170},[174,450,451,453,455,457],{"class":176,"line":177},[174,452,191],{"class":180},[174,454,194],{"class":184},[174,456,181],{"class":180},[174,458,459],{"class":184}," QgsProjectBadLayerHandler\n",[174,461,462,464,467,469],{"class":176,"line":188},[174,463,191],{"class":180},[174,465,466],{"class":184}," pathlib ",[174,468,181],{"class":180},[174,470,471],{"class":184}," Path\n",[174,473,474],{"class":176,"line":202},[174,475,206],{"emptyLinePlaceholder":205},[174,477,478,481,485,488,491],{"class":176,"line":209},[174,479,480],{"class":180},"class",[174,482,484],{"class":483},"svObZ"," RelocatingHandler",[174,486,487],{"class":184},"(",[174,489,490],{"class":483},"QgsProjectBadLayerHandler",[174,492,493],{"class":184},"):\n",[174,495,496,499,502],{"class":176,"line":221},[174,497,498],{"class":180},"    def",[174,500,501],{"class":286}," __init__",[174,503,504],{"class":184},"(self, old_root, new_root):\n",[174,506,507,510,513,516],{"class":176,"line":232},[174,508,509],{"class":286},"        super",[174,511,512],{"class":184},"().",[174,514,515],{"class":286},"__init__",[174,517,518],{"class":184},"()\n",[174,520,521,524,527,530,533,535],{"class":176,"line":241},[174,522,523],{"class":286},"        self",[174,525,526],{"class":184},".old_root, ",[174,528,529],{"class":286},"self",[174,531,532],{"class":184},".new_root ",[174,534,215],{"class":180},[174,536,537],{"class":184}," old_root, new_root\n",[174,539,540,542,545,547],{"class":176,"line":249},[174,541,523],{"class":286},[174,543,544],{"class":184},".report ",[174,546,215],{"class":180},[174,548,549],{"class":184}," []\n",[174,551,552],{"class":176,"line":254},[174,553,206],{"emptyLinePlaceholder":205},[174,555,556,558,561],{"class":176,"line":265},[174,557,498],{"class":180},[174,559,560],{"class":483}," handleBadLayers",[174,562,563],{"class":184},"(self, layers):\n",[174,565,566,569,572,575],{"class":176,"line":283},[174,567,568],{"class":180},"        for",[174,570,571],{"class":184}," node ",[174,573,574],{"class":180},"in",[174,576,577],{"class":184}," layers:\n",[174,579,581,584,586,589,592],{"class":176,"line":580},12,[174,582,583],{"class":184},"            ds_elem ",[174,585,215],{"class":180},[174,587,588],{"class":184}," node.firstChildElement(",[174,590,591],{"class":276},"\"datasource\"",[174,593,332],{"class":184},[174,595,597,600,602],{"class":176,"line":596},13,[174,598,599],{"class":184},"            source ",[174,601,215],{"class":180},[174,603,604],{"class":184}," ds_elem.text()\n",[174,606,608,611,613,615,618],{"class":176,"line":607},14,[174,609,610],{"class":184},"            name ",[174,612,215],{"class":180},[174,614,588],{"class":184},[174,616,617],{"class":276},"\"layername\"",[174,619,620],{"class":184},").text()\n",[174,622,624,627,629,632,634,636,638],{"class":176,"line":623},15,[174,625,626],{"class":184},"            candidate ",[174,628,215],{"class":180},[174,630,631],{"class":184}," source.replace(",[174,633,529],{"class":286},[174,635,526],{"class":184},[174,637,529],{"class":286},[174,639,640],{"class":184},".new_root)\n",[174,642,644,647,649,652,655,658,660],{"class":176,"line":643},16,[174,645,646],{"class":184},"            path_part ",[174,648,215],{"class":180},[174,650,651],{"class":184}," candidate.split(",[174,653,654],{"class":276},"\"|\"",[174,656,657],{"class":184},")[",[174,659,51],{"class":286},[174,661,662],{"class":184},"]\n",[174,664,666,669,672,675,678,681],{"class":176,"line":665},17,[174,667,668],{"class":180},"            if",[174,670,671],{"class":184}," candidate ",[174,673,674],{"class":180},"!=",[174,676,677],{"class":184}," source ",[174,679,680],{"class":180},"and",[174,682,683],{"class":184}," Path(path_part).exists():\n",[174,685,687],{"class":176,"line":686},18,[174,688,689],{"class":184},"                ds_elem.firstChild().setNodeValue(candidate)\n",[174,691,693,696,699,702],{"class":176,"line":692},19,[174,694,695],{"class":286},"                self",[174,697,698],{"class":184},".report.append((name, ",[174,700,701],{"class":276},"\"relocated\"",[174,703,704],{"class":184},"))\n",[174,706,708,711],{"class":176,"line":707},20,[174,709,710],{"class":180},"            else",[174,712,713],{"class":184},":\n",[174,715,717,719,721,723,726,728,731,733,735],{"class":176,"line":716},21,[174,718,695],{"class":286},[174,720,698],{"class":184},[174,722,293],{"class":180},[174,724,725],{"class":276},"\"missing: ",[174,727,299],{"class":286},[174,729,730],{"class":184},"source",[174,732,314],{"class":286},[174,734,296],{"class":276},[174,736,704],{"class":184},[174,738,740],{"class":176,"line":739},22,[174,741,206],{"emptyLinePlaceholder":205},[174,743,745,748,750,753,756,758,761],{"class":176,"line":744},23,[174,746,747],{"class":184},"handler ",[174,749,215],{"class":180},[174,751,752],{"class":184}," RelocatingHandler(",[174,754,755],{"class":276},"\"\u002F\u002Foldserver\u002Fgis\"",[174,757,320],{"class":184},[174,759,760],{"class":276},"\"\u002Fmnt\u002Fgis\"",[174,762,332],{"class":184},[174,764,766],{"class":176,"line":765},24,[174,767,768],{"class":184},"project.setBadLayerHandler(handler)\n",[174,770,772,775,777],{"class":176,"line":771},25,[174,773,774],{"class":184},"project.read(",[174,776,277],{"class":276},[174,778,779],{"class":184},", Qgis.ProjectReadFlag.DontLoadLayouts)\n",[174,781,783,786,789,791],{"class":176,"line":782},26,[174,784,785],{"class":180},"for",[174,787,788],{"class":184}," row ",[174,790,574],{"class":180},[174,792,793],{"class":184}," handler.report:\n",[174,795,797,800,802,805],{"class":176,"line":796},27,[174,798,799],{"class":286},"    print",[174,801,487],{"class":184},[174,803,804],{"class":180},"*",[174,806,807],{"class":184},"row)\n",[14,809,810,812,813,816,817,820,821,154],{},[336,811,338],{}," QGIS calls ",[18,814,815],{},"handleBadLayers"," with the XML nodes of every layer whose source failed to open. The handler can rewrite the ",[18,818,819],{},"datasource"," text in the node — here replacing an old server root with its new mount point when the file exists there — and QGIS then retries those layers. Layers it cannot fix stay invalid and are recorded. The project instance takes ownership of the handler; keep the Python reference for the report. The broader repair workflow, including saving the fixed project, is in ",[26,822,824],{"href":823},"\u002Fspatial-data-processing-automation\u002Flayer-data-sources-and-formats\u002Ffix-broken-layer-paths-in-project-pyqgis\u002F","fixing broken layer paths in a project",[132,826,828],{"id":827},"measure-the-gain-on-your-own-projects","Measure the gain on your own projects",[14,830,831],{},"How much flags save depends entirely on the project: a file-based project with two layouts barely changes, a project with fifty PostGIS layers and an atlas can open ten times faster. Timing a few combinations on a representative project shows which flags are worth it.",[165,833,835],{"className":167,"code":834,"language":169,"meta":170,"style":170},"def timed_read(path, flags):\n    project.clear()\n    t = time.perf_counter()\n    project.read(path, flags)\n    return time.perf_counter() - t\n\npath = \"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\"\ncombos = {\n    \"default\": Qgis.ProjectReadFlags(),\n    \"no layouts\": Qgis.ProjectReadFlag.DontLoadLayouts,\n    \"trust metadata\": Qgis.ProjectReadFlag.TrustLayerMetadata,\n    \"both\": Qgis.ProjectReadFlag.DontLoadLayouts | Qgis.ProjectReadFlag.TrustLayerMetadata,\n    \"unresolved\": Qgis.ProjectReadFlag.DontResolveLayers | Qgis.ProjectReadFlag.DontLoadLayouts,\n}\nfor label, flags in combos.items():\n    print(f\"{label:\u003C16} {timed_read(path, flags):6.2f} s\")\n",[18,836,837,848,853,862,867,880,884,894,904,912,920,928,942,955,960,972],{"__ignoreMap":170},[174,838,839,842,845],{"class":176,"line":177},[174,840,841],{"class":180},"def",[174,843,844],{"class":483}," timed_read",[174,846,847],{"class":184},"(path, flags):\n",[174,849,850],{"class":176,"line":188},[174,851,852],{"class":184},"    project.clear()\n",[174,854,855,858,860],{"class":176,"line":202},[174,856,857],{"class":184},"    t ",[174,859,215],{"class":180},[174,861,262],{"class":184},[174,863,864],{"class":176,"line":209},[174,865,866],{"class":184},"    project.read(path, flags)\n",[174,868,869,872,875,877],{"class":176,"line":221},[174,870,871],{"class":180},"    return",[174,873,874],{"class":184}," time.perf_counter() ",[174,876,305],{"class":180},[174,878,879],{"class":184}," t\n",[174,881,882],{"class":176,"line":232},[174,883,206],{"emptyLinePlaceholder":205},[174,885,886,889,891],{"class":176,"line":241},[174,887,888],{"class":184},"path ",[174,890,215],{"class":180},[174,892,893],{"class":276}," \"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\"\n",[174,895,896,899,901],{"class":176,"line":249},[174,897,898],{"class":184},"combos ",[174,900,215],{"class":180},[174,902,903],{"class":184}," {\n",[174,905,906,909],{"class":176,"line":254},[174,907,908],{"class":276},"    \"default\"",[174,910,911],{"class":184},": Qgis.ProjectReadFlags(),\n",[174,913,914,917],{"class":176,"line":265},[174,915,916],{"class":276},"    \"no layouts\"",[174,918,919],{"class":184},": Qgis.ProjectReadFlag.DontLoadLayouts,\n",[174,921,922,925],{"class":176,"line":283},[174,923,924],{"class":276},"    \"trust metadata\"",[174,926,927],{"class":184},": Qgis.ProjectReadFlag.TrustLayerMetadata,\n",[174,929,930,933,936,939],{"class":176,"line":580},[174,931,932],{"class":276},"    \"both\"",[174,934,935],{"class":184},": Qgis.ProjectReadFlag.DontLoadLayouts ",[174,937,938],{"class":180},"|",[174,940,941],{"class":184}," Qgis.ProjectReadFlag.TrustLayerMetadata,\n",[174,943,944,947,950,952],{"class":176,"line":596},[174,945,946],{"class":276},"    \"unresolved\"",[174,948,949],{"class":184},": Qgis.ProjectReadFlag.DontResolveLayers ",[174,951,938],{"class":180},[174,953,954],{"class":184}," Qgis.ProjectReadFlag.DontLoadLayouts,\n",[174,956,957],{"class":176,"line":607},[174,958,959],{"class":184},"}\n",[174,961,962,964,967,969],{"class":176,"line":623},[174,963,785],{"class":180},[174,965,966],{"class":184}," label, flags ",[174,968,574],{"class":180},[174,970,971],{"class":184}," combos.items():\n",[174,973,974,976,978,980,982,984,987,990,992,995,998,1001,1003,1006],{"class":176,"line":643},[174,975,799],{"class":286},[174,977,487],{"class":184},[174,979,293],{"class":180},[174,981,296],{"class":276},[174,983,299],{"class":286},[174,985,986],{"class":184},"label",[174,988,989],{"class":180},":\u003C16",[174,991,314],{"class":286},[174,993,994],{"class":286}," {",[174,996,997],{"class":184},"timed_read(path, flags)",[174,999,1000],{"class":180},":6.2f",[174,1002,314],{"class":286},[174,1004,1005],{"class":276}," s\"",[174,1007,332],{"class":184},[14,1009,1010,1012,1013,1015],{},[336,1011,338],{}," Clearing before each read makes the timings comparable, though the first read in a session also pays for initialising providers and should be repeated or discarded. Network-backed layers dominate when ",[18,1014,345],{}," helps; many layouts dominate when skipping layouts helps; both matter for large atlas projects. Record the result alongside the script that uses the flags, so the reason for them is not forgotten.",[132,1017,1019],{"id":1018},"inspect-a-project-without-loading-it","Inspect a project without loading it",[14,1021,1022,1023,1026,1027,1030],{},"Sometimes even a fast read is too much — a script indexing thousands of projects just needs their titles, layer sources and CRS. A ",[18,1024,1025],{},".qgz"," is a zip containing the ",[18,1028,1029],{},".qgs"," XML, which can be parsed directly.",[165,1032,1034],{"className":167,"code":1033,"language":169,"meta":170,"style":170},"import zipfile\nimport xml.etree.ElementTree as ET\n\ndef project_summary(path):\n    with zipfile.ZipFile(path) as z:\n        qgs_name = next(n for n in z.namelist() if n.endswith(\".qgs\"))\n        root = ET.fromstring(z.read(qgs_name))\n    title = root.findtext(\"title\") or Path(path).stem\n    crs = root.findtext(\"projectCrs\u002Fspatialrefsys\u002Fauthid\")\n    layers = [(ml.findtext(\"layername\"), ml.findtext(\"provider\"), ml.findtext(\"datasource\"))\n              for ml in root.iter(\"maplayer\")]\n    return {\"title\": title, \"crs\": crs, \"version\": root.get(\"version\"), \"layers\": layers}\n\ns = project_summary(\"\u002Fdata\u002Fprojects\u002Fcity_atlas.qgz\")\nprint(s[\"title\"], s[\"crs\"], s[\"version\"], len(s[\"layers\"]), \"layers\")\n",[18,1035,1036,1043,1056,1060,1070,1083,1117,1130,1152,1166,1190,1209,1242,1246,1260],{"__ignoreMap":170},[174,1037,1038,1040],{"class":176,"line":177},[174,1039,181],{"class":180},[174,1041,1042],{"class":184}," zipfile\n",[174,1044,1045,1047,1050,1053],{"class":176,"line":188},[174,1046,181],{"class":180},[174,1048,1049],{"class":184}," xml.etree.ElementTree ",[174,1051,1052],{"class":180},"as",[174,1054,1055],{"class":286}," ET\n",[174,1057,1058],{"class":176,"line":202},[174,1059,206],{"emptyLinePlaceholder":205},[174,1061,1062,1064,1067],{"class":176,"line":209},[174,1063,841],{"class":180},[174,1065,1066],{"class":483}," project_summary",[174,1068,1069],{"class":184},"(path):\n",[174,1071,1072,1075,1078,1080],{"class":176,"line":221},[174,1073,1074],{"class":180},"    with",[174,1076,1077],{"class":184}," zipfile.ZipFile(path) ",[174,1079,1052],{"class":180},[174,1081,1082],{"class":184}," z:\n",[174,1084,1085,1088,1090,1093,1096,1098,1101,1103,1106,1109,1112,1115],{"class":176,"line":232},[174,1086,1087],{"class":184},"        qgs_name ",[174,1089,215],{"class":180},[174,1091,1092],{"class":286}," next",[174,1094,1095],{"class":184},"(n ",[174,1097,785],{"class":180},[174,1099,1100],{"class":184}," n ",[174,1102,574],{"class":180},[174,1104,1105],{"class":184}," z.namelist() ",[174,1107,1108],{"class":180},"if",[174,1110,1111],{"class":184}," n.endswith(",[174,1113,1114],{"class":276},"\".qgs\"",[174,1116,704],{"class":184},[174,1118,1119,1122,1124,1127],{"class":176,"line":241},[174,1120,1121],{"class":184},"        root ",[174,1123,215],{"class":180},[174,1125,1126],{"class":286}," ET",[174,1128,1129],{"class":184},".fromstring(z.read(qgs_name))\n",[174,1131,1132,1135,1137,1140,1143,1146,1149],{"class":176,"line":249},[174,1133,1134],{"class":184},"    title ",[174,1136,215],{"class":180},[174,1138,1139],{"class":184}," root.findtext(",[174,1141,1142],{"class":276},"\"title\"",[174,1144,1145],{"class":184},") ",[174,1147,1148],{"class":180},"or",[174,1150,1151],{"class":184}," Path(path).stem\n",[174,1153,1154,1157,1159,1161,1164],{"class":176,"line":254},[174,1155,1156],{"class":184},"    crs ",[174,1158,215],{"class":180},[174,1160,1139],{"class":184},[174,1162,1163],{"class":276},"\"projectCrs\u002Fspatialrefsys\u002Fauthid\"",[174,1165,332],{"class":184},[174,1167,1168,1171,1173,1176,1178,1181,1184,1186,1188],{"class":176,"line":265},[174,1169,1170],{"class":184},"    layers ",[174,1172,215],{"class":180},[174,1174,1175],{"class":184}," [(ml.findtext(",[174,1177,617],{"class":276},[174,1179,1180],{"class":184},"), ml.findtext(",[174,1182,1183],{"class":276},"\"provider\"",[174,1185,1180],{"class":184},[174,1187,591],{"class":276},[174,1189,704],{"class":184},[174,1191,1192,1195,1198,1200,1203,1206],{"class":176,"line":283},[174,1193,1194],{"class":180},"              for",[174,1196,1197],{"class":184}," ml ",[174,1199,574],{"class":180},[174,1201,1202],{"class":184}," root.iter(",[174,1204,1205],{"class":276},"\"maplayer\"",[174,1207,1208],{"class":184},")]\n",[174,1210,1211,1213,1215,1217,1220,1223,1226,1229,1232,1234,1237,1239],{"class":176,"line":580},[174,1212,871],{"class":180},[174,1214,994],{"class":184},[174,1216,1142],{"class":276},[174,1218,1219],{"class":184},": title, ",[174,1221,1222],{"class":276},"\"crs\"",[174,1224,1225],{"class":184},": crs, ",[174,1227,1228],{"class":276},"\"version\"",[174,1230,1231],{"class":184},": root.get(",[174,1233,1228],{"class":276},[174,1235,1236],{"class":184},"), ",[174,1238,329],{"class":276},[174,1240,1241],{"class":184},": layers}\n",[174,1243,1244],{"class":176,"line":596},[174,1245,206],{"emptyLinePlaceholder":205},[174,1247,1248,1251,1253,1256,1258],{"class":176,"line":607},[174,1249,1250],{"class":184},"s ",[174,1252,215],{"class":180},[174,1254,1255],{"class":184}," project_summary(",[174,1257,277],{"class":276},[174,1259,332],{"class":184},[174,1261,1262,1264,1267,1269,1272,1274,1276,1278,1281,1283,1285,1287,1290,1292],{"class":176,"line":623},[174,1263,287],{"class":286},[174,1265,1266],{"class":184},"(s[",[174,1268,1142],{"class":276},[174,1270,1271],{"class":184},"], s[",[174,1273,1222],{"class":276},[174,1275,1271],{"class":184},[174,1277,1228],{"class":276},[174,1279,1280],{"class":184},"], ",[174,1282,323],{"class":286},[174,1284,1266],{"class":184},[174,1286,329],{"class":276},[174,1288,1289],{"class":184},"]), ",[174,1291,329],{"class":276},[174,1293,332],{"class":184},[14,1295,1296,1298,1299,1302,1303,1305],{},[336,1297,338],{}," Reading the XML with the standard library needs no QGIS at all, so it runs anywhere — a web service, a CI job — in milliseconds per project. The QGIS version that saved the project is in the root element's ",[18,1300,1301],{},"version"," attribute, useful for finding projects that need updating. This is read-only; for changes, open the project with QGIS and ",[18,1304,396],{}," so it is written back correctly.",[132,1307,1309],{"id":1308},"process-many-projects-in-a-batch","Process many projects in a batch",[14,1311,1312],{},"Combining flags, a handler and a loop processes a whole folder of projects — for example, reporting every layer that points to a decommissioned server.",[14,1314,1315],{},[34,1316,1319,1322,1325,1328,1343,1346,1351,1356,1360,1365,1369,1373,1376,1379,1383,1388,1393],{"viewBox":1317,"role":37,"ariaLabel":1318,"xmlns":39},"0 0 760 196","A loop reading each project with minimal flags, checking every layer source against rules and reporting findings without modifying anything",[41,1320,1321],{},"A project audit loop",[45,1323,1324],{},"For each project file in a folder, the script clears the project instance, reads the file with DontResolveLayers and DontLoadLayouts, collects every layer's source, checks it against rules such as forbidden server paths, and writes one report row per finding. Projects that fail to read are reported too. Nothing is modified.",[49,1326],{"x":51,"y":51,"width":52,"height":1327,"fill":54},"196",[1329,1330,1331],"defs",{},[1332,1333,1339],"marker",{"id":1334,"viewBox":1335,"refX":70,"refY":1336,"markerWidth":1337,"markerHeight":1337,"orient":1338},"rfBatchArrow","0 0 10 10","5","7","auto-start-reverse",[1340,1341],"path",{"d":1342,"fill":395},"M0 0 L10 5 L0 10 z",[56,1344,1345],{"x":58,"y":59,"style":60,"fill":61,"textAnchor":62},"Read light, check, report",[49,1347],{"x":66,"y":1348,"width":1349,"height":1350,"rx":70,"fill":71,"stroke":72,"style":73},"60","200","120",[56,1352,1355],{"x":1353,"y":1354,"style":78,"fill":61,"textAnchor":62},"124","110.78","*.qgz",[56,1357,1359],{"x":1353,"y":1358,"style":83,"fill":72,"textAnchor":62},"136.78","hundreds",[176,1361],{"x1":1362,"y1":1350,"x2":1363,"y2":1350,"stroke":395,"style":1364},"224","266","stroke-width:1.8;marker-end:url(#rfBatchArrow)",[49,1366],{"x":1367,"y":1348,"width":1368,"height":1350,"rx":70,"fill":88,"stroke":89,"style":73},"270","220",[56,1370,1372],{"x":58,"y":1371,"style":389,"fill":89,"textAnchor":62},"97.6","read light",[56,1374,396],{"x":58,"y":1375,"style":394,"fill":395,"textAnchor":62},"123.6",[56,1377,114],{"x":58,"y":1378,"style":394,"fill":395,"textAnchor":62},"149.6",[176,1380],{"x1":1381,"y1":1350,"x2":1382,"y2":1350,"stroke":395,"style":1364},"490","532",[49,1384],{"x":1385,"y":1348,"width":1349,"height":1350,"rx":70,"fill":1386,"stroke":1387,"style":73},"536","#e8efe6","#15803d",[56,1389,1392],{"x":1390,"y":1354,"style":78,"fill":1391,"textAnchor":62},"636","#166534","report",[56,1394,1395],{"x":1390,"y":1358,"style":83,"fill":72,"textAnchor":62},"one row per issue",[165,1397,1399],{"className":167,"code":1398,"language":169,"meta":170,"style":170},"import csv\n\nrows = []\nlight = Qgis.ProjectReadFlag.DontResolveLayers | Qgis.ProjectReadFlag.DontLoadLayouts\nfor qgz in sorted(Path(\"\u002Fdata\u002Fprojects\").rglob(\"*.qgz\")):\n    project.clear()\n    if not project.read(str(qgz), light):\n        rows.append((qgz.name, \"\", \"\", \"could not read project\"))\n        continue\n    for layer in project.mapLayers().values():\n        src = layer.source()\n        if \"\u002F\u002Foldserver\u002F\" in src or src.startswith(\"C:\\\\Users\"):\n            rows.append((qgz.name, layer.name(), layer.providerType(), src))\n\nwith open(\"\u002Fdata\u002Fprojects\u002Fsource_audit.csv\", \"w\", newline=\"\", encoding=\"utf-8\") as fh:\n    csv.writer(fh).writerows([(\"project\", \"layer\", \"provider\", \"source\")] + rows)\nprint(len(rows), \"findings\")\n",[18,1400,1401,1408,1412,1421,1436,1463,1467,1483,1502,1507,1520,1530,1560,1565,1569,1614,1645],{"__ignoreMap":170},[174,1402,1403,1405],{"class":176,"line":177},[174,1404,181],{"class":180},[174,1406,1407],{"class":184}," csv\n",[174,1409,1410],{"class":176,"line":188},[174,1411,206],{"emptyLinePlaceholder":205},[174,1413,1414,1417,1419],{"class":176,"line":202},[174,1415,1416],{"class":184},"rows ",[174,1418,215],{"class":180},[174,1420,549],{"class":184},[174,1422,1423,1426,1428,1431,1433],{"class":176,"line":209},[174,1424,1425],{"class":184},"light ",[174,1427,215],{"class":180},[174,1429,1430],{"class":184}," Qgis.ProjectReadFlag.DontResolveLayers ",[174,1432,938],{"class":180},[174,1434,1435],{"class":184}," Qgis.ProjectReadFlag.DontLoadLayouts\n",[174,1437,1438,1440,1443,1445,1448,1451,1454,1457,1460],{"class":176,"line":221},[174,1439,785],{"class":180},[174,1441,1442],{"class":184}," qgz ",[174,1444,574],{"class":180},[174,1446,1447],{"class":286}," sorted",[174,1449,1450],{"class":184},"(Path(",[174,1452,1453],{"class":276},"\"\u002Fdata\u002Fprojects\"",[174,1455,1456],{"class":184},").rglob(",[174,1458,1459],{"class":276},"\"*.qgz\"",[174,1461,1462],{"class":184},")):\n",[174,1464,1465],{"class":176,"line":232},[174,1466,852],{"class":184},[174,1468,1469,1472,1475,1477,1480],{"class":176,"line":241},[174,1470,1471],{"class":180},"    if",[174,1473,1474],{"class":180}," not",[174,1476,273],{"class":184},[174,1478,1479],{"class":286},"str",[174,1481,1482],{"class":184},"(qgz), light):\n",[174,1484,1485,1488,1491,1493,1495,1497,1500],{"class":176,"line":249},[174,1486,1487],{"class":184},"        rows.append((qgz.name, ",[174,1489,1490],{"class":276},"\"\"",[174,1492,320],{"class":184},[174,1494,1490],{"class":276},[174,1496,320],{"class":184},[174,1498,1499],{"class":276},"\"could not read project\"",[174,1501,704],{"class":184},[174,1503,1504],{"class":176,"line":254},[174,1505,1506],{"class":180},"        continue\n",[174,1508,1509,1512,1515,1517],{"class":176,"line":265},[174,1510,1511],{"class":180},"    for",[174,1513,1514],{"class":184}," layer ",[174,1516,574],{"class":180},[174,1518,1519],{"class":184}," project.mapLayers().values():\n",[174,1521,1522,1525,1527],{"class":176,"line":283},[174,1523,1524],{"class":184},"        src ",[174,1526,215],{"class":180},[174,1528,1529],{"class":184}," layer.source()\n",[174,1531,1532,1535,1538,1541,1544,1546,1549,1552,1555,1558],{"class":176,"line":580},[174,1533,1534],{"class":180},"        if",[174,1536,1537],{"class":276}," \"\u002F\u002Foldserver\u002F\"",[174,1539,1540],{"class":180}," in",[174,1542,1543],{"class":184}," src ",[174,1545,1148],{"class":180},[174,1547,1548],{"class":184}," src.startswith(",[174,1550,1551],{"class":276},"\"C:",[174,1553,1554],{"class":286},"\\\\",[174,1556,1557],{"class":276},"Users\"",[174,1559,493],{"class":184},[174,1561,1562],{"class":176,"line":596},[174,1563,1564],{"class":184},"            rows.append((qgz.name, layer.name(), layer.providerType(), src))\n",[174,1566,1567],{"class":176,"line":607},[174,1568,206],{"emptyLinePlaceholder":205},[174,1570,1571,1574,1577,1579,1582,1584,1587,1589,1593,1595,1597,1599,1602,1604,1607,1609,1611],{"class":176,"line":623},[174,1572,1573],{"class":180},"with",[174,1575,1576],{"class":286}," open",[174,1578,487],{"class":184},[174,1580,1581],{"class":276},"\"\u002Fdata\u002Fprojects\u002Fsource_audit.csv\"",[174,1583,320],{"class":184},[174,1585,1586],{"class":276},"\"w\"",[174,1588,320],{"class":184},[174,1590,1592],{"class":1591},"s9osk","newline",[174,1594,215],{"class":180},[174,1596,1490],{"class":276},[174,1598,320],{"class":184},[174,1600,1601],{"class":1591},"encoding",[174,1603,215],{"class":180},[174,1605,1606],{"class":276},"\"utf-8\"",[174,1608,1145],{"class":184},[174,1610,1052],{"class":180},[174,1612,1613],{"class":184}," fh:\n",[174,1615,1616,1619,1622,1624,1627,1629,1631,1633,1636,1639,1642],{"class":176,"line":643},[174,1617,1618],{"class":184},"    csv.writer(fh).writerows([(",[174,1620,1621],{"class":276},"\"project\"",[174,1623,320],{"class":184},[174,1625,1626],{"class":276},"\"layer\"",[174,1628,320],{"class":184},[174,1630,1183],{"class":276},[174,1632,320],{"class":184},[174,1634,1635],{"class":276},"\"source\"",[174,1637,1638],{"class":184},")] ",[174,1640,1641],{"class":180},"+",[174,1643,1644],{"class":184}," rows)\n",[174,1646,1647,1649,1651,1653,1656,1659],{"class":176,"line":665},[174,1648,287],{"class":286},[174,1650,487],{"class":184},[174,1652,323],{"class":286},[174,1654,1655],{"class":184},"(rows), ",[174,1657,1658],{"class":276},"\"findings\"",[174,1660,332],{"class":184},[14,1662,1663,339,1665,1668,1669,1672],{},[336,1664,338],{},[18,1666,1667],{},"project.clear()"," resets the singleton between files so layers from one project never leak into the next. With layers unresolved and layouts skipped, each read takes a fraction of a second even for large projects, because nothing touches the network or disk beyond the project file. The rules — an old server name, personal folders — catch the sources that break when projects are shared. For changes rather than audits, set new sources and call ",[18,1670,1671],{},"project.write()"," per file, keeping backups.",[132,1674,1676],{"id":1675},"qgis-version-compatibility","QGIS version compatibility",[14,1678,1679,1680,1682,1683,1685,1686,320,1688,320,1690,1692,1693,1695,1696,1698],{},"Read flags are available on QGIS 3.34 LTR, 3.40 LTR and QGIS 4 as ",[18,1681,357],{}," (moved from ",[18,1684,353],{}," in 3.26). ",[18,1687,345],{},[18,1689,396],{},[18,1691,114],{}," and ",[18,1694,349],{}," exist on all of these; newer releases add further flags such as skipping project styles. ",[18,1697,490],{}," subclassing works on all current versions.",[132,1700,1702],{"id":1701},"troubleshooting","Troubleshooting",[137,1704,1705,1713,1721,1727],{},[140,1706,1707,339,1710,1712],{},[336,1708,1709],{},"Layers cannot be drawn after reading.",[18,1711,396],{}," was used; read without it for rendering.",[140,1714,1715,339,1718,1720],{},[336,1716,1717],{},"Extents are wrong.",[18,1719,345],{}," used stale stored extents; read without it or update extents.",[140,1722,1723,1726],{},[336,1724,1725],{},"The script hangs."," A bad-layer dialog is waiting in a GUI session; set a handler.",[140,1728,1729,339,1732,1734],{},[336,1730,1731],{},"Layers from a previous project remain.",[18,1733,1667],{}," was not called between reads.",[132,1736,1738],{"id":1737},"conclusion","Conclusion",[14,1740,1741,1742,1744],{},"Open projects with flags that match the task — skip layouts for analysis, trust stored metadata to avoid source checks, leave layers unresolved for editing paths and auditing — replace the unavailable-layers dialog with a handler that relocates or records missing data, parse ",[18,1743,1025],{}," XML directly for inventories, and clear the project between reads in batches.",[132,1746,1748],{"id":1747},"frequently-asked-questions","Frequently Asked Questions",[14,1750,1751,1754],{},[336,1752,1753],{},"Does TrustLayerMetadata change saved projects?","\nNo; it affects only how this read gathers metadata.",[14,1756,1757,1760,1761,1764],{},[336,1758,1759],{},"Can I read a project without the singleton instance?","\nYes — create ",[18,1762,1763],{},"QgsProject()"," objects for parallel or isolated reads, but many APIs default to the instance.",[14,1766,1767,1770],{},[336,1768,1769],{},"Why is the first read slower than later ones?","\nProviders, CRS databases and caches initialise on first use.",[14,1772,1773,1776],{},[336,1774,1775],{},"Can I save a project read with DontResolveLayers?","\nYes, and that is the usual purpose: layer definitions, styles and the changed sources are written back correctly even though no data was opened.",[14,1778,1779,1782,1783,1786],{},[336,1780,1781],{},"What about projects stored in a database?","\nProjects saved in PostgreSQL or GeoPackage are read with a URI such as ",[18,1784,1785],{},"postgresql:?service=gis&schema=projects&project=atlas","; the same flags apply.",[14,1788,1789,1792],{},[336,1790,1791],{},"Can read flags be used in QGIS Desktop?","\nThe \"trust project when data sources are unavailable\" option in project properties corresponds to trusting metadata.",[132,1794,1796],{"id":1795},"related","Related",[137,1798,1799,1804,1810,1815,1821],{},[140,1800,1801,1803],{},[26,1802,29],{"href":28}," — the guide this recipe belongs to",[140,1805,1806],{},[26,1807,1809],{"href":1808},"\u002Fpyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002Fsave-and-load-qgis-project-pyqgis\u002F","Save and Load a QGIS Project in PyQGIS",[140,1811,1812],{},[26,1813,1814],{"href":823},"Fix Broken Layer Paths in a Project in PyQGIS",[140,1816,1817],{},[26,1818,1820],{"href":1819},"\u002Fspatial-data-processing-automation\u002Fbatch-processing-with-pyqgis\u002Fbatch-process-all-layers-in-project-pyqgis\u002F","Batch Process All Layers in a Project with PyQGIS",[140,1822,1823],{},[26,1824,1826],{"href":1825},"\u002Fpyqgis-fundamentals-environment-setup\u002Fdebugging-pyqgis-scripts\u002Fdebug-invalid-layer-loading-pyqgis\u002F","Debug Invalid Layer Loading in PyQGIS",[1828,1829,1830],"style",{},"html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":170,"searchDepth":188,"depth":188,"links":1832},[1833,1834,1835,1836,1837,1838,1839,1840,1841,1842,1843,1844],{"id":134,"depth":188,"text":135},{"id":157,"depth":188,"text":158},{"id":360,"depth":188,"text":361},{"id":439,"depth":188,"text":440},{"id":827,"depth":188,"text":828},{"id":1018,"depth":188,"text":1019},{"id":1308,"depth":188,"text":1309},{"id":1675,"depth":188,"text":1676},{"id":1701,"depth":188,"text":1702},{"id":1737,"depth":188,"text":1738},{"id":1747,"depth":188,"text":1748},{"id":1795,"depth":188,"text":1796},"Open QGIS projects faster and more safely in scripts with read flags — skipping layout loading, deferring data source checks, trusting stored extents, handling bad layers with a custom handler, inspecting a project without loading data, and reading many projects in a batch.","md",{"slug":1848,"type":1849,"breadcrumb":1850,"datePublished":1851,"dateModified":1851},"open-project-with-read-flags-pyqgis","article","Open a Project with Read Flags","2026-10-02","\u002Fpyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002Fopen-project-with-read-flags-pyqgis",{"title":5,"description":1845},"pyqgis-fundamentals-environment-setup\u002Fworking-with-qgis-projects\u002Fopen-project-with-read-flags-pyqgis\u002Findex","NxHJHr-G14z-HGSs-YOJz07aiQZBPXjy178taQcIQUs",1790966256389]