Bug report #13059
Indents in scratch.py written by 2.10 causes IndentationError in 2.8.2-LTR
|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|
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.
#1 Updated by Kristian Evers over 7 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.