When I run my code in QGIS Python console I get output, but when I run my code from normal console I didn't get any output.
Why does it work only in QGIS Python console?
import sys, os
sys.path.append(r'C:/PROGRA~1/QGIS3~1.16/apps/qgis/python/plugins')
os.environ['PROJ_LIB'] = 'C:\\Program Files\\QGIS 3.16\\share\\proj'
from qgis.core import *
from qgis.utils import *
qgispath = r'C:/PROGRA~1/QGIS3~1.16/apps/qgis'
QgsApplication.setPrefixPath(qgispath, True)
qgs = QgsApplication([], False)
qgs.initQgis()
path = r'C:/Users/ja/Inne/Desktop/POLSKA/PRG_PunktyAdresowe_POLSKA.shp'
lyr = QgsVectorLayer (path, 'PRG_PunktyAdresowe_POLSKA', 'ogr')
for f in lyr.getFeatures():
print(f.attributes())
break
break
command. Can you try using it? – Taras Nov 2 '20 at 13:31print(lyr)
beforefor
-loop. What does it give you? – Taras Nov 2 '20 at 13:36print(lyr.featureCount())
beforefor
loop. I think there are no entities or it can't read and iterate on your layer – Vincent Bré Nov 2 '20 at 13:42