Variables in Python script: ArcCatalog vs. GPK

893
0
02-19-2014 04:55 AM
Labels (1)
BKuiper
Occasional Contributor III
Hi,

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?

example

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
0 Kudos
0 Replies