<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 15, 2018 at 6:10 PM, Andreas Neumann <span dir="ltr"><<a href="mailto:a.neumann@carto.net" target="_blank">a.neumann@carto.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="font-size:10pt;font-family:Verdana,Geneva,sans-serif">
<p>Hi,</p>
<p>I am trying to fix some Python code that worked before, but not anymore due to API changes in master meanwhile.</p>
<p>I am getting a reference to a layer by name and then want to query the 'pendingFields'. Here is the code I use:</p>
<p>---------------------</p>
<p>LayerParcels= QgsProject.instance().<wbr>layerStore().mapLayersByName('<wbr>Parcels')[0]</p>
<p>newParcel = QgsFeature()</p>
<p><span>newParcel </span>.setFields(<span>LayerParc<wbr>els</span>.pendingFields())</p>
<p>-------------------------</p>
<p>The first two lines seem to work, but the third line triggers an error:</p>
<p>AttributeError: 'QgsVectorLayer' object has no attribute 'pendingFields'</p>
<p>Why is that?</p>
<p>This code worked a few weeks before and the 'pendingFields' - according to <a href="https://qgis.org/api/classQgsVectorLayer.html" target="_blank">https://qgis.org/api/<wbr>classQgsVectorLayer.html</a> still exists?</p>
<p>What is wrong with my code?</p>
<p>Thanks for any hints!</p><span class="gmail-HOEnZb"><font color="#888888">
<p>Andreas</p></font></span></div></blockquote><div><br></div><div>Hi Andreas, I believe you should just use  <span>LayerParc<wbr>els</span>.fields() pendingFields is gone.</div><div></div><div><br></div><br clear="all"></div>-- <br><div class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div>