Bug report #12850

scratch.py under user expression folder in master stops 2.8 to start

Added by Saber Razmjooei over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Nathan Woodrow
Category:Expressions
Affected QGIS version:2.8.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20943

Description

In the latest master, QGIS creates scratch.py under .qgis2/python/expression folder. The file stops older versions of QGIS start and comes up with the following error:
Couldn't load qgis.user.
Python support will be disabled.


Traceback (most recent call last):
File "", line 1, in
File "C:/OSGEO4~1/apps/qgis/./python\\qgis\\utils.py", line 478, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:/OSGEO4~1/apps/qgis/./python\\qgis\\user.py", line 42, in
expressions.load(expressionspath)
File "C:/OSGEO4~1/apps/qgis/./python\\qgis\\user.py", line 19, in load_user_expressions
__import__("expressions.{0}".format(name), locals(), globals())
File "C:/OSGEO4~1/apps/qgis/./python\\qgis\\utils.py", line 478, in _import
mod = _builtin_import(name, globals, locals, fromlist, level)
File "C:/Users/Saber/.qgis2/python\\expressions\\scratch.py", line 9, in
@qgsfunction(group='Custom')
TypeError: qgsfunction() takes exactly 2 arguments (1 given)

To reproduce the error:
1- Open QGIS master
2- Add a vector file
3- Use vector calculator to add a column
4- Save your layer
5- Exit QGIS master
6- Try to open QGIS 2.8.2

scratch_29.py Magnifier - scratch.py under .qgis2\\python\\expressions for master (280 Bytes) Saber Razmjooei, 2015-05-29 09:00 AM

scratch_28.py Magnifier - scratch.py under .qgis2\\python\\expressions for 2.8.2 (451 Bytes) Saber Razmjooei, 2015-05-29 09:00 AM


Related issues

Related to QGIS Application - Bug report #12852: Handle errors in python expressions to avoid crashes Closed 2015-05-30

Associated revisions

Revision 4b6ad0c2
Added by Nathan Woodrow over 6 years ago

Fix #12850 - Add missing args='auto' keyword'

History

#1 Updated by Saber Razmjooei over 6 years ago

Actually, just clicking on the attribute calculater triggers the generation og scratch.py and no other calc is required.

#2 Updated by Saber Razmjooei over 6 years ago

  • Priority changed from High to Severe/Regression

#3 Updated by Saber Razmjooei over 6 years ago

  • Operating System deleted (Windows)
  • OS version deleted (7)

#4 Updated by Nathan Woodrow over 6 years ago

  • Assignee set to Nathan Woodrow
  • Resolution set to fixed/implemented

Sorry about that. I made that argument optional and forgot I have to make sure it works in 2.8 where it isn't optional.

#5 Updated by Nathan Woodrow over 6 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF