Running model in Notebook

470
2
Jump to solution
05-02-2023 09:23 AM
Labels (1)
TychoGranville
Occasional Contributor II

I've got to either be missing something obvious or misunderstanding the use of notebook completely.

I'm trying to string a bunch of simple models together to run in notebook.

They run as expected in Model Builder, but they just return the two print statements within "try" without  in the snippet below (path hidden and the <space> didn't past into the spoiler). Various models do different things (table exports, change shapefiles, pull data from different places, etc.) though they reside in the same toolbox. What'd I miss?

Spoiler

import arcpy
arcpy.env.overwriteOutput = True

arcpy.ImportToolbox("secret path to toolbox...", "tbx")

####Table Exports####

#ManatronExportsToAssessorTablesPro
#will not be needed once everything is converted to Pro
try:
print("start ManatronExportsToAssessorTablesPro")
arcpy.ManatronExportsToAssessorTablesPro_tbx
print("finish ManatronExportsToAssessorTablesPro")
except:
print("failed ManatronExportsToAssessorTablesPro")

 

Thanks,

Tycho 

0 Kudos
1 Solution

Accepted Solutions
TychoGranville
Occasional Contributor II

Sorry about the indentation. I basically just copied the image from the help doc  here and thought it would work if I dumped it into Notepad.

Capture.JPG

And I missed the () at the end since none of the models needs an argument - added them and it works. So yep, missed something obvious from not paying attention (as usual).

View solution in original post

2 Replies
DanPatterson
MVP Esteemed Contributor

you import toolboxes which is fine, but is this supposed to be a model?

arcpy.ManatronExportsToAssessorTablesPro_tbx

it definitely won't work since it doesn't need to be prefaced by arcpy

PS,  providin proper formatting would be useful

Code formatting ... the Community Version - Esri Community


... sort of retired...
TychoGranville
Occasional Contributor II

Sorry about the indentation. I basically just copied the image from the help doc  here and thought it would work if I dumped it into Notepad.

Capture.JPG

And I missed the () at the end since none of the models needs an argument - added them and it works. So yep, missed something obvious from not paying attention (as usual).