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

Indents in scratch.py written by 2.10 causes IndentationError in 2.8.2-LTR #21129

Closed
qgib opened this issue Jul 1, 2015 · 2 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Jul 1, 2015

Author Name: Kristian Evers (@kbevers)
Original Redmine Issue: 13059
Affected QGIS version: master
Redmine category:expressions


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.


@qgib
Copy link
Contributor Author

qgib commented Jul 3, 2015

Author Name: Kristian Evers (@kbevers)


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.


  • 8895 was configured as user.patch

  • user.patch (Kristian Evers) - QGIS/python/user.py

@qgib
Copy link
Contributor Author

qgib commented Jul 4, 2015

Author Name: Nathan Woodrow (@NathanW2)


Fixed in changeset "fbad68075b71e29c3384f63f1bbb3593d61d6853".


  • status_id was changed from Open to Closed

@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions labels May 25, 2019
@qgib qgib added this to the Version 2.10 milestone May 25, 2019
@qgib qgib closed this as completed May 25, 2019
Ailurupoda pushed a commit to SIRS-CLS/QGIS that referenced this issue Feb 18, 2020
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! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

No branches or pull requests

1 participant