ArcPy-Import Toolbox question

512
1
12-28-2017 11:22 AM
AndyBohnhoff
New Contributor II

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\__init__.py", line 124, in ImportToolbox
return import_toolbox(input_file, module_name)
File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\toolbox_code.py", 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\toolbox_code.py", line 414, in generate_toolbox_module
'exec')
File "L:\SharedData\Denver\Wattenberg\GIS\Users\AndyBohnhoff\Models\Andys Toolbox.tbx", line 11
def 1FnumView():
^
SyntaxError: invalid syntax

0 Kudos
1 Reply
DanPatterson_Retired
MVP Esteemed Contributor

are these multiple attempts packed into one?  Where is the script that you are using to import the toolbox?  Is it assigned to a tool in arctoolbox?  Do you have a toolbox created in arctoolbox and do you have the model and the other tools included in it?

Some elaboration and screenshots of what you have would be useful

0 Kudos