Variables in Python script: ArcCatalog vs. GPK

Discussion created by kuiperfoliage on Feb 19, 2014

is there some way to make sure python scripts run in a 'strict' mode in regards to variables?
It seems that ArcCatalog/ArcMap is much more lenient with global variables, but when running the generated GPK inside my application all these errors popup because some variables are not defined correctly and thus the script fail.

Can i somehow trigger ArcCatalog/ArcMap to already show these problems?


test = "example"

def function():
  arcpy.AddMessage("test: " + test)

works in ArcCatalog but will fail in the GPK because you have to add

global test

within the function