Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening Project in Standalone PyQGIS script leads to Python Crash #24008

Closed
qgib opened this issue Jan 18, 2017 · 3 comments
Closed

Opening Project in Standalone PyQGIS script leads to Python Crash #24008

qgib opened this issue Jan 18, 2017 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins

Comments

@qgib
Copy link
Contributor

qgib commented Jan 18, 2017

Author Name: Raphael Dumas (@radumas)
Original Redmine Issue: 16094
Affected QGIS version: 2.14.10
Redmine category:python_plugins


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()
1. Get the project instance
project = QgsProject.instance()
1. Open the project
project.read(QFileInfo('C:/path/to/project/project.qgs'))
print project.fileName()
1. 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

@qgib
Copy link
Contributor Author

qgib commented Jan 19, 2017

Author Name: Saber Razmjooei (@saberraz)


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


  • priority_id was changed from Severe/Regression to Low
  • status_id was changed from Open to Feedback
  • category_id was changed from Project Loading/Saving to Python plugins

@qgib
Copy link
Contributor Author

qgib commented Jan 20, 2017

Author Name: Raphael Dumas (@radumas)


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

@qgib
Copy link
Contributor Author

qgib commented Jan 23, 2017

Author Name: Raphael Dumas (@radumas)


Upgrading to @2.14.11@ solved this problem.


  • status_id was changed from Feedback to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Plugins Crash/Data Corruption labels May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption Plugins
Projects
None yet
Development

No branches or pull requests

1 participant