AnsweredAssumed Answered

arcpy.ImportToolbox('..Data Management Tools.tbx') fails with SP4

Question asked by StevenHas on May 2, 2012
Latest reply on May 2, 2012 by StevenHas
Hi folks,

this problem started with install of SP4, I'd rather try and fix it than uninstall everything to try and get off SP4.

I've tried reinstalling SP4

import arcpy
>>> arcpy.ImportToolbox(r"C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx")

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 94, in ImportToolbox
return import_toolbox(input_file, module_name)
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 411, in import_toolbox
mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name)
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\toolbox_code.py", line 389, in generate_toolbox_module
mycode = compile(code.encode('utf-8'), toolbox.pathName, 'exec')
File "C:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Data Management Tools.tbx", line 3976
"""MakeFeatureLayer_management(in_features, out_layer, {where_clause}, {workspace}, {field_info})

Creates a feature layer from an input feature class or layer file. The layer
that is created by the tool is temporary and will not persist after the session
ends unless the layer is saved to disk or the map document is saved.

INPUTS:
in_features (Feature Layer):
The input feature class or layer used the make the new layer. Complex feature
classes, such as annotation and dimensions, are not valid inputs to this tool.
where_clause {SQL Expression}:
An SQL expression used to select a subset of features. The syntax for the
expression differs slightly depending on the data source. For example, if you're
querying file or ArcSDE geodatabases, shapefiles, or coverages, enclose field
names in double quotes: "MY_FIELD" If you're querying personal geodatabases,
enclose fields in square brackets: [MY_FIELD] In Python, strings are enclosed in
matching single or double quotes. To create
a string that contains quotes (as is common with a WHERE clause in SQL
expressions), you can escape the quotes (using a backslash) or triple quote the
string. For example, if the intended WHERE clause is "CITY_NAME" = 'Chicago'you
could enclose the entire string in double quotes, then escape the interior
double quotes like this: " \"CITY_NAME\" = 'Chicago' " Or you could enclose the
entire string in single quotes, then escape the
interior single quotes like this: ' "CITY_NAME" = \'Chicago\' 'Or you could
enclose the entire string in triple quotes without escaping: """ "CITY_NAME" =





^
SyntaxError: invalid syntax





Any ideas?

Outcomes