Created
May 11, 2016 19:47
-
-
Save danmaps/9754eb745a63e231090318e92a7242d8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def createScript(): | |
import os | |
tbx_path = r"D:\sfe\MOTOROLA.tbx" | |
tbx_alias = "MOTOROLA" | |
modelname = "Model1-frequency" | |
outputLocation = r"D:\sfe\MOTOROLA\PYTHONS" | |
outScript = open(os.path.join(outputLocation, "outScript.py"), "w") | |
outScript.write("import arcpy\n") | |
outScript.write('arcpy.ImportToolbox(r"' + tbx_path + '")\n') | |
outScript.write('print "toolbox imported successfully"\n') | |
outScript.write("arcpy." + modelname + "_" + tbx_alias + "()\n") | |
outScript.write('print "model completed successfully"\n') | |
outScript.close() | |
if __name__ == '__main__': | |
createScript() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment