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

Adding a new function expression that also prints in the console halts QGIS #26610

Closed
qgib opened this issue Apr 14, 2018 · 1 comment
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Crash/Data Corruption PyQGIS Related to the PyQGIS API

Comments

@qgib
Copy link
Contributor

qgib commented Apr 14, 2018

Author Name: Tudor Bărăscu (@tudorbarascu)
Original Redmine Issue: 18723
Affected QGIS version: 3.1(master)
Redmine category:pyqgis_console


I have a point layer with 3 points.

I created the following function:

from qgis.core import *
from qgis.gui import *
from random import uniform

@qgsfunction(args='auto', group='QTIBIA Engineering')
def random_records(value1, value2, feature, parent):
    """
    Generates a random value..
    """
    print(value1, value2)
    return uniform(value1, value2)

If I put in the layer label: uniform(0, 100.5) QGIS halts on the third print.
So, printing from the function halts QGIS.

@qgib
Copy link
Contributor Author

qgib commented Apr 14, 2018

Author Name: Nyall Dawson (@nyalldawson)


This isn't safe to do - better to use the thread safe qgis logger classes, e.g. QgsLogger, QgsMessageLog


  • resolution was changed from to invalid
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Apr 14, 2018
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! PyQGIS Related to the PyQGIS API Crash/Data Corruption labels 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 PyQGIS Related to the PyQGIS API
Projects
None yet
Development

No branches or pull requests

1 participant