Skip to content
Permalink
Browse files

Fix crash on user.py import of expressions

  • Loading branch information
NathanW2 committed Jun 26, 2015
1 parent ab0aa04 commit 21121286f011ea4608060056e75f9b8f77ea7106
Showing with 19 additions and 16 deletions.
  1. +19 −16 python/user.py
@@ -44,22 +44,25 @@ def load_user_expressions(path):
if not os.path.exists(initfile):
open(initfile, "w").close()

import site
reload(site)
try:
import expressions

import expressions
expressions.load = load_user_expressions
expressions.load(expressionspath)
expressions.template = """\"\"\"
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
\"\"\"
expressions.load = load_user_expressions
expressions.load(expressionspath)
expressions.template = """\"\"\"
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
\"\"\"
from qgis.core import *
from qgis.gui import *
from qgis.core import *
from qgis.gui import *
@qgsfunction(args='auto', group='Custom')
def func(value1, feature, parent):
return value1
"""
@qgsfunction(args='auto', group='Custom')
def func(value1, feature, parent):
return value1
"""
except ImportError:
# We get a import error and crash for some reason even if we make the expressions package
# TODO Fix the crash on first load with no expressions folder
# But for now it's not the end of the world if it doesn't laod the first time
pass

0 comments on commit 2112128

Please sign in to comment.
You can’t perform that action at this time.