Bug report #13059
Indents in scratch.py written by 2.10 causes IndentationError in 2.8.2-LTR
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Expressions | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Windows | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 21129 |
Description
This bug presents it self when running two version of QGIS, 2.10.0 and 2.8.2-ltr, on the same computer with the same user.
The problem is that QGIS 2.10 automatically writes a poorly formatted scratch.py in .qgis2/plugins/expressions/. The generated file results in an IndentationError when QGIS 2.8.2-ltr is opened. The IndentationError occurs because all lines (except the first) in the file are indented for spaces. This obviously doesn't play nicely with the python interpreter. The exception is not seen in 2.10 because exceptions caused by bad user-code are not raised.
The problem arises in python/user.py because of a indented doc-string. I have attached a copy of a user.py that outputs a file that is formatted properly.
Associated revisions
Fix #13059 - Fix expression template load error
Fix #13059 - Fix expression template load error
- Backported to 2.10.1
- Cherry-picked from fbad68075b71e2
History
#1 Updated by Kristian Evers over 9 years ago
- File user.patch added
Steps to reproduce:
1. Open QGIS 2.10
2. Add a layer.
3. Go to the Field Calculator (this will prompt QGIS to write a new 'scratch.py' file if it is not already there)
4. Close QGIS 2.10
5. Open QGIS 2.8.2-ltr
6. Python Error will show up before the main window. A IndentationError is reported.
See the attached pathc file.
#2 Updated by Nathan Woodrow over 9 years ago
- Status changed from Open to Closed
Fixed in changeset fbad68075b71e29c3384f63f1bbb3593d61d6853.