Bug report #16094

Opening Project in Standalone PyQGIS script leads to Python Crash

Added by Raphael Dumas almost 8 years ago. Updated almost 8 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:Python plugins
Affected QGIS version:2.14.10 Regression?:No
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:24008

Description

In Windows 7 x64 SP1 using Python 2.7 x64, I installed QGIS 2.14.10 from the standalone x64 installer. I was able to run this script successfully in 2.14.9, but noticed that since I installed 2.14.10 the script causes a crash in `Python.exe`

Script source: http://gis.stackexchange.com/a/223248/36886

from qgis.core import *
from PyQt4.QtCore import QFileInfo
from PyQt4.QtGui import QApplication

QgsApplication.setPrefixPath(r"C:\\Program Files\\QGIS Essen\\apps\\qgis-ltr", True)
qgs = QApplication([], False)
QgsApplication.initQgis()
# Get the project instance
project = QgsProject.instance()
# Open the project
project.read(QFileInfo('C:/path/to/project/project.qgs'))
print project.fileName()
# Get the layers in the project
layers = QgsMapLayerRegistry.instance().mapLayers()

print layers
QgsApplication.exitQgis()

I've tried with two different project files, both of which open correctly in QGIS

History

#1 Updated by Saber Razmjooei almost 8 years ago

  • Priority changed from Severe/Regression to Low
  • Status changed from Open to Feedback
  • Category changed from Project Loading/Saving to Python plugins

Check your path to QGIS:
C:\\Program Files\\QGIS Essen\\apps\\qgis-ltr
Does that exist? Or changed to QGIS 2.14?

#2 Updated by Raphael Dumas almost 8 years ago

Yup, still exists. I manually changed it from 2.14 during install so that the install path didn't flip flop between LTR releases.

#3 Updated by Raphael Dumas almost 8 years ago

  • Status changed from Feedback to Closed

Upgrading to 2.14.11 solved this problem.

Also available in: Atom PDF