AnsweredAssumed Answered

ArcPy-Import Toolbox question

Question asked by abohnhoff on Dec 28, 2017
Latest reply on Dec 28, 2017 by Dan_Patterson

Newbie here. Since ModelBuilder does not have a task scheduler, I thought I would write a simple script in python to call that model and then add a task scheduler to that. Could someone give me a hand, not sure what the error message means below. Am thinking I need to set an alias for my tool name, but not sure how that is done. Thanks.


>>> import arcpy
>>> arcpy.ImportToolbox(r"L:\D\W\GIS\Users\AAA\Models\Andys Toolbox.tbx", 1FumView)
Parsing error SyntaxError: invalid syntax (line 1)
>>> arcpy.ImportToolbox(r"L:\D\W\GIS\Users\AAA\Models\Andys Toolbox.tbx", "1FumView")
Runtime error
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\", line 124, in ImportToolbox
return import_toolbox(input_file, module_name)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\", line 440, in import_toolbox
mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name, use_alt_alias)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\", line 414, in generate_toolbox_module
File "L:\SharedData\Denver\Wattenberg\GIS\Users\AndyBohnhoff\Models\Andys Toolbox.tbx", line 11
def 1FnumView():
SyntaxError: invalid syntax