I tried a code to get attribute values from internet. Line by line from console the code worked well. As soon I was running it as Python file, QGIS crashed without comments. Trying commenting lines out - the reason was in line that begins with
Is it usual, that code works well in console, but not as code from redactor?
import urllib.request url1 = 'https://geoportaal.maaamet.ee/url/xgis-xy.php?' for f in er_f.getFeatures(): pt=f.geometry().centroid().asPoint() y=pt.x() x=pt.y() url2='x='+str(x)+'&y='+str(y)+'&d=1' url=url1+url2 print(url) req = urllib.request.Request(url) response = urllib.request.urlopen(req) tunnus = response.read() print(tunnus)